code: def average_datetimes(dt_list):
      
      if sys.version_info < (3, 3):
          # timestamp added in python 3.3
          import time
  
          def timestamp_func(dt):
              return time.mktime(dt.timetuple())
      else:
          timestamp_func = datetime.timestamp
  
      total = [timestamp_func(dt) for dt in dt_list]
      return datetime.fromtimestamp(sum(total) / len(total))
docs: Average a series of datetime objects.
  
      .. note::
  
          This function assumes all datetime objects are naive and in the same
          time zone (UTC).
  
      Args:
          dt_list (iterable): Datetime objects to average
  
      Returns: Average datetime as a datetime object