code: def datetime_structure_hook(
      dt_like: str | datetime, _: t.Any
  ) -> datetime:
      if isinstance(dt_like, str):
          return datetime.fromisoformat(dt_like)
      elif isinstance(dt_like, datetime):
          return dt_like
      else:
          raise Exception(f"Unable to parse datetime from '{dt_like}'")
  
imports: from __future__ import annotations
  import typing
  from datetime import datetime
  import attr
  from cattr.gen import make_dict_structure_fn
  from cattr.gen import make_dict_unstructure_fn
  from .pkg import pkg_version_info
label_desc: Use image node_id 1 for calling a global function with example usage: datetime_structure_hook(dt_like, _) and returns: datetime, dt_like