def register(name, func=None):
    """
    Function or decorator which registers a given function as a
    recognized control command.
    """

    def decorator(func):
        # Perform the registration
        ControlDaemon._register(name, func)
        return func

    # If func was given, call the decorator, otherwise, return the
    # decorator
    if func:
        return decorator(func)
    else:
        return decorator
Function or decorator which registers a given function as a
    recognized control command.