code: def to_unix_ms(dt: datetime) -> int:
      
      utcoffset = dt.utcoffset()
      ep = epoch if utcoffset is None else epoch_tz
      return as_int((dt - ep).total_seconds() * 1000)
docs: convert a datetime to number of milliseconds since 1970 and calculate timezone offset