code: def type_spec_register(name, allow_overwrite=True):
      """Decorator used to register a unique name for a TypeSpec subclass.
  
      Unlike TensorFlow's `type_spec_registry.register`, this function allows a new
      `TypeSpec` to be registered with a `name` that already appears in the
      registry (overwriting the `TypeSpec` already registered with that name). This
      allows for re-definition of `AutoCompositeTensor` subclasses in test
      environments and iPython.
  
      Args:
        name: The name of the type spec. Must have the form
        `"{project_name}.{type_name}"`.  E.g. `"my_project.MyTypeSpec"`.
        allow_overwrite: `bool`, if `True` then the entry in the `TypeSpec` registry
          keyed by `name` will be overwritten if it exists. If `False`, then
          behavior is the same as `type_spec.register`.
  
      Returns:
        A class decorator that registers the decorated class with the given name.
      """
      # pylint: disable=protected-access
      if (
          allow_overwrite
          and name in type_spec_registry._NAME_TO_TYPE_SPEC
      ):
          type_spec_registry._TYPE_SPEC_TO_NAME.pop(
              type_spec_registry._NAME_TO_TYPE_SPEC.pop(name)
          )
      return type_spec_registry.register(name)
  
imports: import contextlib
  import functools
  import threading
  import numpy
  import tensorflow.compat.v2
  from tensorflow.python.framework import composite_tensor
  from tensorflow.python.framework import type_spec
  from tensorflow.python.framework import type_spec_registry
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.util import tf_inspect
  from tensorflow.python.util import variable_utils
label_desc: Use image node_id 7 for calling a global function with example usage: type_spec_register(name, allow_overwrite) and returns: type_spec_registry