code: def register(self, key, *types):
      register = self.registry[get_origin(key)].register
  
      # This decorator supports stacking multiple decorators, which is not
      # supported by multipledipatch (which returns a Dispatch object rather
      # than the original function).
      def decorator(fn):
          register(*types)(fn)
          return fn
  
      return decorator
  
imports: from collections import defaultdict
  from multipledispatch.dispatcher import Dispatcher, expand_tuples
  from funsor.typing import Variadic, deep_type, get_origin, get_type_hints, typing_wrap
label_desc: Use image node_id 2 for calling the KeyedRegistry obj's underlying member method code with example usage: obj.register(key) and returns: decorator, fn