def deprecated(func_or_text, environ=os.environ):
def inner(func):<EOL><INDENT>message = (<EOL>'<STR_LIT>'.format(func.__name__)<EOL>if callable(func_or_text) else<EOL>func_or_text<EOL>)<EOL>@functools.wraps(func)<EOL>def new_func(*args, **kwargs):<EOL><INDENT>with warnings.catch_warnings():<EOL><INDENT>if getdebug(environ):<EOL><INDENT>warnings.simplefilter('<STR_LIT>', DeprecationWarning)<EOL><DEDENT>warnings.warn(message, category=DeprecationWarning,<EOL>stacklevel=<NUM_LIT:3>)<EOL><DEDENT>return func(*args, **kwargs)<EOL><DEDENT>return new_func<EOL><DEDENT>return inner(func_or_text) if callable(func_or_text) else inner<EOL>
Decorator used to mark functions as deprecated. It will result in a
warning being emmitted hen the function is called.

Usage:

>>> @deprecated
... def fnc():
...     pass

Usage (custom message):

>>> @deprecated('This is deprecated')
... def fnc():
...     pass

:param func_or_text: message or callable to decorate
:type func_or_text: callable
:param environ: optional environment mapping
:type environ: collections.abc.Mapping
:returns: nested decorator or new decorated function (depending on params)
:rtype: callable