code: def _decompose_type(t, to_list=True):
      if isinstance(t, TypeVar):
          if t.__bound__ is not None:
              ts = [t.__bound__]
          else:
              # For T_co, __constraints__ is ()
              ts = list(t.__constraints__)
      elif hasattr(t, "__origin__") and t.__origin__ == Union:
          ts = t.__args__
      else:
          if not to_list:
              return None
          ts = [t]
      # Ignored: Generator has incompatible item type "object"; expected "Type[Any]"
      ts = [TYPE2ABC.get(_t, _t) for _t in ts]  # type: ignore[misc]
      return ts
  
imports: import collections
  import functools
  import numbers
  import sys
  from torch.utils.data.datapipes._hook_iterator import hook_iterator, _SnapshotState
  from typing import Any, Dict, Iterator, Generic, List, Set, Tuple, TypeVar, Union, get_type_hints
  from typing import _eval_type, _tp_cache, _type_check, _type_repr
  from typing import ForwardRef
  from abc import ABCMeta
  from typing import _GenericAlias
label_desc: Use image node_id 2 for calling a global function with example usage: _decompose_type(t, to_list) and returns: ts, None