code: def solar_term(self, year, degrees, timezone='UTC'):
          
          twopi = 2 * pi
          tz = pytz.timezone(timezone)
  
          # Find out the sun's current longitude.
  
          sun = ephem.Sun(ephem.Date(str(year)))
          current_longitude = sun.hlong - pi
  
          # Find approximately the right time of year.
  
          target_longitude = degrees * ephem.degree
          difference = (target_longitude - current_longitude) % twopi
          t0 = ephem.Date(str(year)) + 365.25 * difference / twopi
  
          # Zero in on the exact moment.
  
          def f(t):
              sun.compute(t)
              longitude = sun.hlong - pi
              return ephem.degrees(target_longitude - longitude).znorm
  
          d = ephem.Date(ephem.newton(f, t0, t0 + ephem.minute))
          solar_term = d.datetime() + tz.utcoffset(d.datetime())
  
          return solar_term.date()
docs: Returns the date of the solar term for the given longitude
          and the given year.
  
          Solar terms are used for Chinese and Taiwanese holidays
          (e.g. Qingming Festival in Taiwan).
  
          More information:
          - https://en.wikipedia.org/wiki/Solar_term
          - https://en.wikipedia.org/wiki/Qingming
  
          This function is adapted from the following topic:
          https://answers.launchpad.net/pyephem/+question/110832