code: def register_subclasscheck(cls):
      """
      Decorator for registering a custom ``__subclasscheck__`` method for ``cls``
      which is only ever invoked in :func:`deep_issubclass`.
  
      This is primarily intended for working with the :mod:`typing` library at runtime.
      Prefer overriding ``__subclasscheck__`` in the usual way with a metaclass
      where possible.
      """
  
      def _fn(fn):
          _subclasscheck_registry[cls] = fn
          return fn
  
      return _fn
  
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 4 for calling a global function with example usage: register_subclasscheck(cls) and returns: _fn, fn