code: def get_register_func(base_class, nickname):
      """Get registrator function.
  
      Parameters
      ----------
      base_class : type
          base class for classes that will be reigstered
      nickname : str
          nickname of base_class for logging
  
      Returns
      -------
      a registrator function
      """
      if base_class not in _REGISTRY:
          _REGISTRY[base_class] = {}
      registry = _REGISTRY[base_class]
  
      def register(klass, name=None):
          """Register functions"""
          assert issubclass(
              klass, base_class
          ), f"Can only register subclass of {base_class.__name__}"
          if name is None:
              name = klass.__name__
          name = name.lower()
          if name in registry:
              warnings.warn(
                  f"\033[91mNew {nickname} {klass.__module__}.{klass.__name__} registered with name {name} is"
                  f"overriding existing {nickname} {registry[name].__module__}.{registry[name].__name__}\033[0m",
                  UserWarning,
                  stacklevel=2,
              )
          registry[name] = klass
          return klass
  
      register.__doc__ = (
          f"Register {nickname} to the {nickname} factory"
      )
      return register
  
imports: import json
  import warnings
  from .base import string_types
label_desc: Use image node_id 2 for calling a global function with example usage: get_register_func(base_class, nickname) and returns: register, klass