def METHOD_NAME(function):
    """
    Get the ConsoleManager lock, run the function, then release the lock.
    :param function: Function to wrap.
    """
    def wrapper(*args, **kwargs):
        console_manager = args[0]
        if not console_manager._lock.acquire(False):
            raise ConsoleBusyError("Console is in use.")
        try:
            return function(*args, **kwargs)
        finally:
            console_manager._lock.release()
    return wrapper