docs: def earthsun_distance(moment):
      r'''Calculates the distance between the earth and the sun as a function 
      of date and time. Uses the Reda and Andreas (2004) model described in [1]_, 
      originally incorporated into the excellent 
      `pvlib library <https://github.com/pvlib/pvlib-python>`_
      
      Parameters
      ----------
      moment : datetime
          Time and date for the calculation, in UTC time (or GMT, which is
          almost the same thing); not local time, [-]
          
      Returns
      -------
      distance : float
          Distance between the center of the earth and the center of the sun,
          [m]        
  
      Examples
      --------
      >>> earthsun_distance(datetime(2003, 10, 17, 13, 30, 30))
      149090925951.18338
      
      The distance at perihelion, which occurs at 4:21 according to this
      algorithm. The real value is 04:38 (January 2nd).
          
      >>> earthsun_distance(datetime(2013, 1, 2, 4, 21, 50))
      147098089490.67123
      
      The distance at aphelion, which occurs at 14:44 according to this
      algorithm. The real value is dead on - 14:44 (July 5).
      
      >>> earthsun_distance(datetime(2013, 7, 5, 14, 44, 51, 0))
      152097354414.36044
          
      Notes
      -----
      This function is quite accurate. The difference comes from the impact of 
      the moon.
  
      Note this function is not continuous; the sun-earth distance is not 
      sufficiently accurately modeled for the change to be continuous throughout
      each day.
  
      References
      ----------
      .. [1] Reda, Ibrahim, and Afshin Andreas. "Solar Position Algorithm for 
         Solar Radiation Applications." Solar Energy 76, no. 5 (January 1, 2004):
         577-89. https://doi.org/10.1016/j.solener.2003.12.003.
      '''
      from fluids.optional import spa
      delta_t = spa.calculate_deltat(moment.year, moment.month)
      import calendar
      unixtime = calendar.timegm(moment.timetuple())
      # Convert datetime object to unixtime
      return float(spa.earthsun_distance(unixtime, delta_t=delta_t))*au