def _raise_if_teardown_called(callable: Callable) -> Callable:
    """
    Decorator that raises an exception if consul lock manager has been torn down.
    :param callable: the callable to wrap (where `ConsulLock` is always passed as the first argument)
    :return: wrapped callable
    """
    def wrapper(consul_lock: "ConsulLockManager", *args, **kwargs):
        if consul_lock._teardown_called:
            raise UnusableStateError("Teardown has been called on the lock manager")
        return callable(consul_lock, *args, **kwargs)
    return wrapper
def _raise_if_teardown_called ( callable : Callable ) -> Callable : def wrapper ( consul_lock : "ConsulLockManager" , * args , ** kwargs ) : if consul_lock . _teardown_called : raise UnusableStateError ( "Teardown has been called on the lock manager" ) return callable ( consul_lock , * args , ** kwargs ) return wrapper
Decorator that raises an exception if consul lock manager has been torn down.
    :param callable: the callable to wrap (where `ConsulLock` is always passed as the first argument)
    :return: wrapped callable