def simple_decorator(decorator):
    """This decorator can be used to turn simple functions
    into well-behaved decorators, so long as the decorators
    are fairly simple. If a decorator expects a function and
    returns a function (no descriptors), and if it doesn't
    modify function attributes or docstring, then it is
    eligible to use this. Simply apply @simple_decorator to
    your decorator and it will automatically preserve the
    docstring and function attributes of functions to which
    it is applied."""
    def new_decorator(funct_target):
        """This will be modified"""
        decorated = decorator(funct_target)
        decorated.__name__ = funct_target.__name__
        decorated.__doc__  = funct_target.__doc__
        decorated.__dict__.update(funct_target.__dict__)
        return decorated
    # Now a few lines needed to make simple_decorator itself
    # be a well-behaved decorator.
    new_decorator.__name__ = decorator.__name__
    new_decorator.__doc__ = decorator.__doc__
    new_decorator.__dict__.update(decorator.__dict__)
    return new_decorator
def simple_decorator ( decorator ) : def new_decorator ( funct_target ) : decorated = decorator ( funct_target ) decorated . __name__ = funct_target . __name__ decorated . __doc__ = funct_target . __doc__ decorated . __dict__ . update ( funct_target . __dict__ ) return decorated new_decorator . __name__ = decorator . __name__ new_decorator . __doc__ = decorator . __doc__ new_decorator . __dict__ . update ( decorator . __dict__ ) return new_decorator
This decorator can be used to turn simple functions
    into well-behaved decorators, so long as the decorators
    are fairly simple. If a decorator expects a function and
    returns a function (no descriptors), and if it doesn't
    modify function attributes or docstring, then it is
    eligible to use this. Simply apply @simple_decorator to
    your decorator and it will automatically preserve the
    docstring and function attributes of functions to which
    it is applied.