def state(pre, post, attr='state'):
    """State decorator"""

    def decorator(method):
        @six.wraps(method)
        def inner(self, *args, **kwargs):
            setattr(self, attr, pre)
            result = method(self, *args, **kwargs)
            setattr(self, attr, post)
            return result
        return inner
    return decorator