The example given in Ephem works fine, what the problem is using the observers exact longitude which is not shown in the examples.
Instead of using a general location of a city, I need to use the exact longitude of the observer.
import ephem
madrid = ephem.city('Madrid')
madrid.date = '1978/10/3 11:32'
print(madrid.sidereal_time())