@@ -0,0 +1,1133 @@
+from functools import update_wrapper%0A%0A%0Adef decorate(*decorators):%0A    %22%22%22%0A    Before:%0A%0A    @app.route('/')%0A    @jsonify%0A    @validate_form(MyForm)%0A    def index(my_form):%0A        return 'hi'%0A%0A    You don't have access to the original, base %60index%60 function.  In Python 3,%0A    functools' %60update_wrapper%60 takes care of this by adding a %60__wrapped__%60%0A    field to the wrappers, but %60__wrapped__%60 is unfortunately not provided in%0A    Python 2.%0A%0A%0A    After:%0A%0A    @decorate(%0A        app.route('/'),%0A        jsonify,%0A        validate_form(MyForm))%0A    def index(my_form):%0A        return 'hi'%0A%0A    Now we can easily test the original, base %60index%60 function by retrieving it%0A    via %60index.__wrapped__%60: %60assert index.__wrapped__() == 'hi'%60.%0A    %22%22%22%0A%0A    def decorator(function):%0A        _function = compose(*decorators)(function)%0A        update_wrapper(_function, function)%0A        _function.__wrapped__ = function%0A        return _function%0A%0A    return decorator%0A%0A%0Adef compose(*functions):%0A    %22e.g., compose(f1, f2, f3)(x) == f1(f2(f3(x)))%22%0A    return lambda arg: %5C%0A        reduce(lambda composed, f: f(composed), reversed(functions), arg)%0A

add Python decorator utility to be used later