(func)
return wrapper
Raise an exception before calling the actual function if the device is
    not connection.
Raise an exception before calling the actual function if the device is
    not connection.
Raise an exception before calling the actual function if the device is not connection .
def connection_required(func):
    """Raise an exception before calling the actual function if the device is
    not connection.
    """
    @functools.wraps(func)
    def wrapper(self, *args, **kwargs):
        if not self._connected:
            raise exceptions.NotConnectedError()
        return func(self, *args, **kwargs)
    return wrapper
def connection_required ( func ) : @ functools . wraps ( func ) def wrapper ( self , * args , * * kwargs ) : if not self . _connected : raise exceptions . NotConnectedError ( ) return func ( self , * args , * * kwargs ) return wrapper