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)
Decorator used to register object type

    Examples
    --------
    >>> @register_object
    >>> class MyObject:
    >>> ... pass

    Parameters
    ----------
    type_key : str or cls
        The type key of the object
    
python/dgl/_ffi/object.py