def decorated(origFunc, newFunc, decoration=None):
    """
    Copies the original function's name/docs/signature to the new function, so that the docstrings
    contain relevant information again. 
    Most importantly, it adds the original function signature to the docstring of the decorating function,
    as well as a comment that the function was decorated. Supports nested decorations.
    """
    if not hasattr(origFunc, '_decorated'):
        # a func that has yet to be treated - add the original argspec to the docstring
        import inspect
        newFunc.__doc__ = "Original Arguments: %s\n\n%s" % (
            inspect.formatargspec(*inspect.getargspec(origFunc)), 
            inspect.getdoc(origFunc) or "")
    else:
        newFunc.__doc__ = origFunc.__doc__ or ""
    newFunc.__doc__ += "\n(Decorated by %s)" % (decoration or "%s.%s" % (newFunc.__module__, newFunc.__name__))
    newFunc.__name__ = origFunc.__name__
    newFunc.__module__ = origFunc.__module__
    newFunc.__dict__ = origFunc.__dict__    # share attributes
    newFunc._decorated = True   # stamp the function as decorated
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/moBu/site-packages/PyMoBu-0.2/pymobu/core.py/decorated/original