code: def coerce_datetime(
      v: dt.datetime | None, tz: dt.tzinfo | None = None
  ) -> DateTime | None:
      """Convert ``v`` into a timezone-aware ``pendulum.DateTime``.
  
      * If ``v`` is *None*, *None* is returned.
      * If ``v`` is a naive datetime, it is converted to an aware Pendulum DateTime.
      * If ``v`` is an aware datetime, it is converted to a Pendulum DateTime.
        Note that ``tz`` is **not** taken into account in this case; the datetime
        will maintain its original tzinfo!
      """
      if v is None:
          return None
      if isinstance(v, DateTime):
          return v if v.tzinfo else make_aware(v, tz)
      # Only dt.datetime is left here.
      return pendulum.instance(v if v.tzinfo else make_aware(v, tz))
  
imports: from __future__ import annotations
  import datetime
  from typing import TYPE_CHECKING, overload
  import pendulum
  from dateutil.relativedelta import relativedelta
  from pendulum.datetime import DateTime
label_desc: Use image node_id 18 for calling a global function with example usage: coerce_datetime(v, tz) and returns: pendulum, None, unknown