def METHOD_NAME(exc):
    if exc.response:
        return exc
    if (session.user is None and not request.is_xhr and not request.is_json and request.blueprint != 'auth' and
            not g.get('get_request_user_failed')):
        return redirect_to_login(reason=_('Please log in to access this page.'))
    return render_error(exc, _('Access Denied'), get_error_description(exc), exc.code)