(f)
return state_check
Build a read-only State instance and pass to `f` as the `state` kwarg if the `state` kwarg is None.
    Function `f` should have have at least two kwargs, `user` and `state`.
Build a read-only State instance and pass to `f` as the `state` kwarg if the `state` kwarg is None.
    Function `f` should have have at least two kwargs, `user` and `state`.
Build a read - only State instance and pass to f as the state kwarg if the state kwarg is None . Function f should have have at least two kwargs user and state .
def make_ro_state(f):
    """
    Build a read-only State instance and pass to `f` as the `state` kwarg if the `state` kwarg is None.
    Function `f` should have have at least two kwargs, `user` and `state`.
    """

    @wraps(f)
    def state_check(self, *args, **kwargs):
        state = kwargs.pop('state', None)
        user = kwargs.pop('user', None)
        if state is None:
            state = self.client.get_state(user=user)
        kwargs['state'] = state
        kwargs['user'] = user
        return f(self, *args, **kwargs)

    return state_check
def make_ro_state ( f ) : @ wraps ( f ) def state_check ( self , * args , * * kwargs ) : state = kwargs . pop ( 'state' , None ) user = kwargs . pop ( 'user' , None ) if state is None : state = self . client . get_state ( user = user ) kwargs [ 'state' ] = state kwargs [ 'user' ] = user return f ( self , * args , * * kwargs ) return state_check