def deprecated_method(replacement):
    def outer(fun):
        msg = "%s() is deprecated; use %s() instead" % (
            fun.__name__, replacement)
        if fun.__doc__ is None:
            fun.__doc__ = msg

        @functools.wraps(fun)
        def inner(self, *args, **kwargs):
            warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
            return getattr(self, replacement)(*args, **kwargs)
        return inner
    return outer


# --- Process.connections() 'kind' parameter mapping
A decorator which can be used to mark a method as deprecated
dataset/ETHPy150Open giampaolo/psutil/psutil/_common.py/deprecated_method