code: def ensure_utc(time, tz='UTC'):
      
      if not time.tzinfo:
          time = time.replace(tzinfo=pytz.timezone(tz))
      return time.replace(tzinfo=pytz.utc)
docs: Normalize a time. If the time is tz-naive, assume it is UTC.