code: def deep_issubclass(subcls, cls):
      """
      Enhanced version of :func:`issubclass` that can handle structured types,
      including Funsor terms, :class:`~typing.Tuple`, and :class:`~typing.FrozenSet`.
  
      Does not support more advanced :mod:`typing` features such as
      :class:`~typing.TypeVar`, arbitrary :class:`~typing.Generic` subtypes,
      forward references, or mutable collection types like :class:`~typing.List`.
      Will attempt to fall back to :func:`issubclass` when it encounters a type in
      ``subcls`` or ``cls`` that it does not understand.
  
      Usage::
  
          class A: pass
          class B(A): pass
  
          assert deep_issubclass(typing.Tuple[int, B], typing.Tuple[int, A])
          assert not deep_issubclass(typing.Tuple[int, A], typing.Tuple[int, B])
  
          assert deep_issubclass(typing.Tuple[A, A], typing.Tuple[A, ...])
          assert not deep_issubclass(typing.Tuple[B], typing.Tuple[A, ...])
  
      :param subcls: A class that may be a subclass of ``cls``.
      :param cls: A class that may be a parent class of ``subcls``.
      """
      # compare to pytypes.is_subtype(subcls, cls)
  
      # handle unpacking
      if isinstance(subcls, _RuntimeSubclassCheckMeta):
          try:
              return deep_issubclass(subcls.__args__[0], cls)
          except TypeError as e:
              if e.args[0] == "issubclass() arg 1 must be a class":
                  return deep_issubclass(
                      get_origin(subcls.__args__[0]), cls
                  )
              raise
  
      if get_origin(subcls) is typing.Union:
          return all(
              deep_issubclass(arg, cls) for arg in get_args(subcls)
          )
  
      if subcls is typing.Any:
          return cls is typing.Any
  
      try:
          return _subclasscheck_registry[get_origin(cls)](cls, subcls)
      except KeyError:
          return issubclass(subcls, cls)
  
imports: import functools
  import sys
  import typing
  import weakref
  import typing_extensions
  from multipledispatch.variadic import Variadic
  from multipledispatch.variadic import isvariadic
label_desc: Use image node_id 9 for calling a global function with example usage: deep_issubclass(subcls, cls) and returns: all, unknown, _subclasscheck_registry, deep_issubclass, issubclass, deep_issubclass