def if_running(meth):
        """Decorator for service methods that must be ran only if service is in
        running state."""

        @wraps(meth)
        def check_running(self, *args, **kwargs):
            if not self.running:
                return
            return meth(self, *args, **kwargs)

        return check_running
def if_running ( meth ) : @ wraps ( meth ) def check_running ( self , * args , ** kwargs ) : if not self . running : return return meth ( self , * args , ** kwargs ) return check_running
Decorator for service methods that must be ran only if service is in
        running state.