def requireAuthentication(json=False):

    def decorator(fn):

        def wrapper(**kwargs):
            if 'user' in request.session:
                return fn(**kwargs)
if json:
    return {'exception': 'NotAuthorized', 'error':
        'You are not authorized, please log on'}
redirect('/login?url={0}{1}'.format(request.path, '?' + request.
    query_string if request.query_string else ''))
return wrapper
return decorator
Объедините два декоратора python в один