def METHOD_NAME(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        s = flask.session
        #: already authenticated?
        if is_authenticated(s):
            perms = parse_permissions(s)
            if perm not in perms or not perms[perm]:
                response = "Forbidden", 403
            else:
                response = func(*args, **kwargs)
        else:
            clear_session(s)
            if flask.request.headers.get("X-Requested-With") == "XMLHttpRequest":
                response = "Forbidden", 403
            else:
                location = flask.url_for(
                    "app.login",
                    next=flask.request.url
                )
                response = flask.redirect(location)
        return response
    return wrapper