The library offers a separation()
function that gives the angle between two spherical coordinates; look near the bottom of this section of the Quick Reference:
http://rhodesmill.org/pyephem/quick.html#other-functions
I think you will get the angle you are seeking if you run:
a = ephem.separation((panel_az, panel_alt), (sun_az, sun_alt))
print a
Good luck!