code: def deprecated(replacement=None, version=None):
      
  
      def outer(oldfun):
          def inner(*args, **kwargs):
              msg = "%s is deprecated" % oldfun.__name__
              if version is not None:
                  msg += "will be removed in version %s;" % version
              if replacement is not None:
                  msg += "; use %s instead" % (replacement)
              warnings.warn(msg, DeprecationWarning, stacklevel=2)
              if callable(replacement):
                  return replacement(*args, **kwargs)
              else:
                  return oldfun(*args, **kwargs)
  
          return inner
  
      return outer
docs: A decorator which can be used to mark functions as deprecated.
      replacement is a callable that will be called with the same args
      as the decorated function.
      >>> import pytest
      >>> @deprecated()
      ... def foo1(x):
      ...     return x
      ...
      >>> pytest.warns(DeprecationWarning, foo1, 1)
      1
      >>> def newfun(x):
      ...     return 0
      ...
      >>> @deprecated(newfun, '1.1')
      ... def foo2(x):
      ...     return x
      ...
      >>> pytest.warns(DeprecationWarning, foo2, 1)
      0
      >>>