def expose_command(name: Callable | str | list[str] | None = None) -> Callable:
    """
    Decorator to expose methods to the command interface.

    The exposed command will have the name of the defined method.

    Methods can also be exposed via multiple names by passing the names to this
    decorator.

    e.g. if a layout wants "up" and "previous" to call the
    same method:

    @expose_command("previous")
    def up(self):
        ...

    `up` will be exposed as `up` and `previous`.

    Multiple names can be passed as a list.
    """

    def wrapper(func: Callable):
        setattr(func, "_cmd", True)
        if name is not None:
            if not hasattr(func, "_mapping"):
                setattr(func, "_mapping", list())
            if isinstance(name, list):
                func._mapping += name  # type:ignore
            elif isinstance(name, str):
                func._mapping.append(name)  # type:ignore
            else:
                logger.error("Unexpected value received in command decorator: %s", name)
        return func

    # If the decorator is added with no parentheses then we should treat it
    # as if it had been i.e. expose the decorated method
    if callable(name):
        func = name
        name = None
        return wrapper(func)

    return wrapper

    Decorator to expose methods to the command interface.

    The exposed command will have the name of the defined method.

    Methods can also be exposed via multiple names by passing the names to this
    decorator.

    e.g. if a layout wants "up" and "previous" to call the
    same method:

    @expose_command("previous")
    def up(self):
        ...

    `up` will be exposed as `up` and `previous`.

    Multiple names can be passed as a list.
    
libqtile/command/base.py