code: def register_extension(cls, fcreate=None):
      """Register a extension class to TVM.
  
      After the class is registered, the class will be able
      to directly pass as Function argument generated by TVM.
  
      Parameters
      ----------
      cls : class
          The class object to be registered as extension.
  
      fcreate : function, optional
          The creation function to create a class object given handle value.
  
      Note
      ----
      The registered class is requires one property: _tvm_handle.
  
      If the registered class is a subclass of NDArray,
      it is required to have a class attribute _array_type_code.
      Otherwise, it is required to have a class attribute _tvm_tcode.
  
      - ```_tvm_handle``` returns integer represents the address of the handle.
      - ```_tvm_tcode``` or ```_array_type_code``` gives integer represents type
        code of the class.
  
      Returns
      -------
      cls : class
          The class being registered.
  
      Example
      -------
      The following code registers user defined class
      MyTensor to be DLTensor compatible.
  
      .. code-block:: python
  
         @tvm.register_extension
         class MyTensor(object):
             _tvm_tcode = tvm.ArgTypeCode.ARRAY_HANDLE
  
             def __init__(self):
                 self.handle = _LIB.NewDLTensor()
  
             @property
             def _tvm_handle(self):
                 return self.handle.value
      """
      assert hasattr(cls, "_tvm_tcode")
      if fcreate:
          raise ValueError(
              "Extension with fcreate is no longer supported"
          )
      _reg_extension(cls, fcreate)
      return cls
  
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 3 for calling a global function with example usage: register_extension(cls, fcreate) and returns: cls