code: def _datetime_to_pl_timestamp(
      dt: datetime, time_unit: TimeUnit | None
  ) -> int:
      """Convert a python datetime to a timestamp in given time unit."""
      if dt.tzinfo is None:
          # Make sure to use UTC rather than system time zone.
          dt = dt.replace(tzinfo=timezone.utc)
      microseconds = dt.microsecond
      seconds = _timestamp_in_seconds(dt)
      if time_unit == "ns":
          return seconds * NS_PER_SECOND + microseconds * 1_000
      elif time_unit == "us" or time_unit is None:
          return seconds * US_PER_SECOND + microseconds
      elif time_unit == "ms":
          return seconds * MS_PER_SECOND + microseconds // 1_000
      raise ValueError(
          f"`time_unit` must be one of {{'ms', 'us', 'ns'}}, got {time_unit!r}"
      )
  
imports: from __future__ import annotations
  import sys
  from datetime import datetime, time, timedelta, timezone
  from decimal import Context
  from functools import lru_cache
  from typing import TYPE_CHECKING, Any, Callable, Sequence, TypeVar, overload
  from polars.dependencies import _ZONEINFO_AVAILABLE, zoneinfo
label_desc: Use image node_id 8 for calling a global function with example usage: _datetime_to_pl_timestamp(dt, time_unit) and returns: unknown, unknown, unknown