def deprecated(message):
def f__(f):<EOL><INDENT>def f_(*args, **kwargs):<EOL><INDENT>from warnings import warn<EOL>warn(message, category=DeprecationWarning, stacklevel=<NUM_LIT:2>)<EOL>return f(*args, **kwargs)<EOL><DEDENT>f_.__name__ = f.__name__<EOL>f_.__doc__ = f.__doc__<EOL>f_.__dict__.update(f.__dict__)<EOL>return f_<EOL><DEDENT>return f__<EOL>
Decorator for deprecating functions and methods.

    ::

        @deprecated("'foo' has been deprecated in favour of 'bar'")
        def foo(x):
            pass