code: def deprecated(*args, **kwargs):
      
      if args and isinstance(args[0], string_types):
          kwargs['reason'] = args[0]
          args = args[1:]
  
      if args and not callable(args[0]):
          raise TypeError(repr(type(args[0])))
  
      if args:
          action = kwargs.get('action', 'always')
          category = kwargs.get('category', DeprecationWarning)
          adapter_cls = kwargs.pop('adapter_cls', ClassicAdapter)
          adapter = adapter_cls(**kwargs)
  
          wrapped = args[0]
          if inspect.isclass(wrapped):
              wrapped = adapter(wrapped)
              return wrapped
  
          elif inspect.isroutine(wrapped):
  
              @wrapt.decorator(adapter=adapter)
              def wrapper_function(wrapped_, instance_, args_, kwargs_):
                  msg = adapter.get_deprecated_msg(wrapped_, instance_)
                  with warnings.catch_warnings():
                      warnings.simplefilter(action, category)
                      warnings.warn(msg, category=category, stacklevel=2)
                  return wrapped_(*args_, **kwargs_)
  
              return wrapper_function(wrapped)
  
          else:
              raise TypeError(repr(type(wrapped)))
  
      return functools.partial(deprecated, **kwargs)
docs: This is a decorator which can be used to mark functions
      as deprecated. It will result in a warning being emitted
      when the function is used.
  
      **Classic usage:**
  
      To use this, decorate your deprecated function with **@deprecated** decorator:
  
      .. code-block:: python
  
         from deprecated import deprecated
  
  
         @deprecated
         def some_old_function(x, y):
             return x + y
  
      You can also decorate a class or a method:
  
      .. code-block:: python
  
         from deprecated import deprecated
  
  
         class SomeClass(object):
             @deprecated
             def some_old_method(self, x, y):
                 return x + y
  
  
         @deprecated
         class SomeOldClass(object):
             pass
  
      You can give a "reason" message to help the developer to choose another function/class,
      and a "version" number to specify the starting version number of the deprecation.
  
      .. code-block:: python
  
         from deprecated import deprecated
  
  
         @deprecated(reason="use another function", version='1.2.0')
         def some_old_function(x, y):
             return x + y