code: def register_object(type_key=None):
      """register object type.
  
      Parameters
      ----------
      type_key : str or cls
          The type key of the node
  
      Examples
      --------
      The following code registers MyObject
      using type key "test.MyObject"
  
      .. code-block:: python
  
        @tvm.register_object("test.MyObject")
        class MyObject(Object):
            pass
      """
      object_name = (
          type_key if isinstance(type_key, str) else type_key.__name__
      )
  
      def register(cls):
          """internal register function"""
          if hasattr(cls, "_type_index"):
              tindex = cls._type_index
          else:
              tidx = ctypes.c_uint()
              if not _RUNTIME_ONLY:
                  check_call(
                      _LIB.TVMObjectTypeKey2Index(
                          c_str(object_name), ctypes.byref(tidx)
                      )
                  )
              else:
                  # directly skip unknown objects during runtime.
                  ret = _LIB.TVMObjectTypeKey2Index(
                      c_str(object_name), ctypes.byref(tidx)
                  )
                  if ret != 0:
                      return cls
              tindex = tidx.value
          _register_object(tindex, cls)
          return cls
  
      if isinstance(type_key, str):
          return register
  
      return register(type_key)
  
file_path: tvm/python/tvm/_ffi/registry.py
imports: import sys
  import ctypes
  from .base import _LIB, check_call, py_str, c_str, string_types, _FFI_MODE, _RUNTIME_ONLY
label_desc: Use image node_id 1 for calling a global function with example usage: register_object(type_key) and returns: register, cls, register, cls