code: def deprecated(message):
      
      def wrapper(fn):
          def deprecated_method(*args, **kargs):
              warnings.warn(message, DeprecationWarning, 2)
              return fn(*args, **kargs)
          # TODO: use decorator ?  functools.wrapper ?
          deprecated_method.__name__ = fn.__name__
          deprecated_method.__doc__ = "%s\n\n%s" % (message, fn.__doc__)
          return deprecated_method
      return wrapper
docs: Deprecated function decorator.