code: def register_object(type_key=None):
      """Decorator used to register object type
  
      Examples
      --------
      >>> @register_object
      >>> class MyObject:
      >>> ... pass
  
      Parameters
      ----------
      type_key : str or cls
          The type key of the object
      """
      object_name = (
          type_key if isinstance(type_key, str) else type_key.__name__
      )
  
      def register(cls):
          """internal register function"""
          tindex = ctypes.c_int()
          ret = _LIB.DGLObjectTypeKey2Index(
              c_str(object_name), ctypes.byref(tindex)
          )
          if ret == 0:
              _register_object(tindex.value, cls)
          return cls
  
      if isinstance(type_key, str):
          return register
      return register(type_key)
  
file_path: dgl/python/dgl/_ffi/object.py
imports: from __future__ import absolute_import
  import ctypes
  import sys
  from ..None import _api_internal
  from .base import _FFI_MODE, _LIB, c_str, check_call, py_str
  from .object_generic import convert_to_object, ObjectGeneric
label_desc: Use image node_id 2 for calling a global function with example usage: register_object(type_key) and returns: register, cls, register