code: def formatIBDatetime(
      t: Union[dt.date, dt.datetime, str, None]
  ) -> str:
      """Format date or datetime to string that IB uses."""
      if not t:
          s = ""
      elif isinstance(t, dt.datetime):
          # convert to UTC timezone
          t = t.astimezone(tz=dt.timezone.utc)
          s = t.strftime("%Y%m%d %H:%M:%S UTC")
      elif isinstance(t, dt.date):
          t = dt.datetime(
              t.year, t.month, t.day, 23, 59, 59
          ).astimezone(tz=dt.timezone.utc)
          s = t.strftime("%Y%m%d %H:%M:%S UTC")
      else:
          s = t
      return s
  
imports: import asyncio
  import datetime
  import logging
  import math
  import signal
  import sys
  import time
  from dataclasses import fields, is_dataclass
  from typing import AsyncIterator, Awaitable, Callable, Iterator, List, Optional, Union
  import eventkit
label_desc: Use image node_id 25 for calling a global function with example usage: formatIBDatetime(t) and returns: s