def reg(func_name: str, func: Callable = None) -> Callable:
    """Register a new function

    Example

    .. highlight:: python
    .. code-block:: python

        @registry.reg("func_name")
        def func(args):
            ....


    Parameters
    ----------
    func_name : str
        Registry key for the function
    func : Callable, optional
        Function to be registered, by default None

    Returns
    -------
    Callable
        Function in registry

    Raises
    ------
    RuntimeError
        If same key is founded in registry, will raise a RuntimeError
    """
    if func_name in BACKEND_FUNCTIONS:
        raise RuntimeError(
            "{name} funcion has already been registered.".format(name=func_name)
        )

    def _do_reg(func):
        BACKEND_FUNCTIONS[func_name] = func
        return func

    if func is None:
        return _do_reg
    return func
Register a new function

    Example

    .. highlight:: python
    .. code-block:: python

        @registry.reg("func_name")
        def func(args):
            ....


    Parameters
    ----------
    func_name : str
        Registry key for the function
    func : Callable, optional
        Function to be registered, by default None

    Returns
    -------
    Callable
        Function in registry

    Raises
    ------
    RuntimeError
        If same key is founded in registry, will raise a RuntimeError
    
python/aitemplate/backend/registry.py