code: def register_extension(cls, fcreate=None):
      """Register a extension class to DGL.
  
      After the class is registered, the class will be able
      to directly pass as Function argument generated by DGL.
  
      Parameters
      ----------
      cls : class
          The class object to be registered as extension.
  
      Note
      ----
      The registered class is requires one property: _dgl_handle and a class attribute _dgl_tcode.
  
      - ```_dgl_handle``` returns integer represents the address of the handle.
      - ```_dgl_tcode``` gives integer represents type code of the class.
  
      Returns
      -------
      cls : class
          The class being registered.
  
      fcreate : function, optional
          The creation function to create a class object given handle value.
  
      Example
      -------
      The following code registers user defined class
      MyTensor to be DLTensor compatible.
  
      .. code-block:: python
  
         @dgl.register_extension
         class MyTensor(object):
             _dgl_tcode = dgl.TypeCode.ARRAY_HANDLE
  
             def __init__(self):
                 self.handle = _LIB.NewDLTensor()
  
             @property
             def _dgl_handle(self):
                 return self.handle.value
      """
      if fcreate and cls._dgl_tcode < TypeCode.EXT_BEGIN:
          raise ValueError(
              "Cannot register create when extension tcode is same as buildin"
          )
      _reg_extension(cls, fcreate)
      return cls
  
imports: from __future__ import absolute_import
  import ctypes
  import sys
  import numpy
  from .base import _FFI_MODE, _LIB, c_array, c_str, check_call, string_types
  from .runtime_ctypes import dgl_shape_index_t, DGLArray, DGLArrayHandle, DGLContext, DGLDataType, TypeCode
label_desc: Use image node_id 7 for calling a global function with example usage: register_extension(cls, fcreate) and returns: cls