code: def timestamp_localize(value):
          
          if isinstance(value, datetime.datetime):
              if not value.tzinfo:
                  value = pytz.UTC.localize(value)
              else:
                  value = value.astimezone(pytz.UTC)
              # Assumes utc (and add the microsecond part)
              value = calendar.timegm(value.timetuple()) + \
                  value.microsecond / 1e6
          return value
docs: Save timestamp as utc
  
          :param value: Timestamp (in UTC or with tz_info)
          :type value: float | datetime.datetime
          :return: Localized timestamp
          :rtype: float