code: def Deprecated(*args, **kwargs):
      """Annotation for documenting a deprecated API.
  
      Deprecated APIs may be removed in future releases of Ray.
  
      Args:
          message: a message to help users understand the reason for the
              deprecation, and provide a migration path.
  
      Examples:
          >>> from ray.util.annotations import Deprecated
          >>> @Deprecated
          ... def func(x):
          ...     return x
  
          >>> @Deprecated(message="g() is deprecated because the API is error "
          ...   "prone. Please call h() instead.")
          ... def g(y):
          ...     return y
      """
      if len(args) == 1 and len(kwargs) == 0 and callable(args[0]):
          return Deprecated()(args[0])
  
      doc_message = (
          "**DEPRECATED**: This API is deprecated and may be removed "
          "in future Ray releases."
      )
      warning_message = (
          "This API is deprecated and may be removed in future Ray releases. "
          "You could suppress this warning by setting env variable "
          'PYTHONWARNINGS="ignore::DeprecationWarning"'
      )
  
      warning = kwargs.pop("warning", False)
  
      if "message" in kwargs:
          doc_message = doc_message + "\n" + kwargs["message"]
          warning_message = warning_message + "\n" + kwargs["message"]
          del kwargs["message"]
  
      if kwargs:
          raise ValueError("Unknown kwargs: {}".format(kwargs.keys()))
  
      def inner(obj):
          _append_doc(obj, message=doc_message, directive="warning")
          _mark_annotated(obj)
  
          if not warning:
              return obj
  
          if inspect.isclass(obj):
              obj_init = obj.__init__
  
              def patched_init(*args, **kwargs):
                  warnings.warn(
                      warning_message,
                      RayDeprecationWarning,
                      stacklevel=2,
                  )
                  return obj_init(*args, **kwargs)
  
              obj.__init__ = patched_init
              return obj
          else:
              # class method or function.
              @wraps(obj)
              def wrapper(*args, **kwargs):
                  warnings.warn(
                      warning_message,
                      RayDeprecationWarning,
                      stacklevel=2,
                  )
                  return obj(*args, **kwargs)
  
              return wrapper
  
      return inner
  
file_path: ray/python/ray/util/annotations.py
imports: from typing import Optional
  import inspect
  import sys
  import warnings
  from functools import wraps
label_desc: Use image node_id 3 for calling a global function with example usage: Deprecated() and returns: inner, Deprecated, obj, obj, wrapper, obj_init, obj