class_docstr: Implements global Registry.
  
  Authors: Joan Puigcerver (jpuigcerver@), Alexander Kolesnikov (akolesnikov@)
class_docstr_tok: ["Implements","global","Registry",".","Authors",":","Joan","Puigcerver","(","jpuigcerver","@",")",",","Alexander","Kolesnikov","(","akolesnikov","@",")"]
docstr: Creates a function that registers its input.
docstr_tok: ["Creates","a","function","that","registers","its","input","."]
code: def register(name, item_type, replace=False):
      """Creates a function that registers its input."""
  
      if item_type not in ["object", "function", "factory", "class"]:
          raise ValueError("Unknown item type: %s" % item_type)
  
      def _register(item):
          if name in Registry.global_registry() and not replace:
              raise KeyError(
                  "The name {!r} was already registered in with type {!r}".format(
                      name, item_type
                  )
              )
  
          Registry.global_registry()[name] = (item, item_type)
          return item
  
      return _register
  
file_path: scenic/scenic/dataset_lib/big_transfer/registry.py
imports: import ast
  import functools
  import logging
label_desc: Use image node_id 2 for calling the Registry obj's underlying member method code with example usage: obj.register(name, item_type, replace) and returns: _register, item