code: def deprecated(
      version: str,
      message: Optional[str] = None,
      add_deprecation_to_docstring: bool = True,
      warning: Optional[Type[exc.SADeprecationWarning]] = None,
      enable_warnings: bool = True,
  ) -> Callable[[_F], _F]:
      """Decorates a function and issues a deprecation warning on use.
  
      :param version:
        Issue version in the warning.
  
      :param message:
        If provided, issue message in the warning.  A sensible default
        is used if not provided.
  
      :param add_deprecation_to_docstring:
        Default True.  If False, the wrapped function's __doc__ is left
        as-is.  If True, the 'message' is prepended to the docs if
        provided, or sensible default if message is omitted.
  
      """
  
      if add_deprecation_to_docstring:
          header = ".. deprecated:: %s %s" % (
              version,
              (message or ""),
          )
      else:
          header = None
  
      if message is None:
          message = "Call to deprecated function %(func)s"
  
      if warning is None:
          warning = exc.SADeprecationWarning
  
      message += " (deprecated since: %s)" % version
  
      def decorate(fn: _F) -> _F:
          assert message is not None
          assert warning is not None
          return _decorate_with_warning(
              fn,
              warning,
              message % dict(func=fn.__name__),
              version,
              header,
              enable_warnings=enable_warnings,
          )
  
      return decorate
  
imports: from __future__ import annotations
  import re
  from typing import Any
  from typing import Callable
  from typing import Dict
  from typing import Match
  from typing import Optional
  from typing import Sequence
  from typing import Set
  from typing import Tuple
  from typing import Type
  from typing import TypeVar
  from typing import Union
  from .None import compat
  from .langhelpers import _hash_limit_string
  from .langhelpers import _warnings_warn
  from .langhelpers import decorator
  from .langhelpers import inject_docstring_text
  from .langhelpers import inject_param_text
  from ..None import exc
label_desc: Use image node_id 5 for calling a global function with example usage: deprecated(version, message, add_deprecation_to_docstring, warning, enable_warnings) and returns: decorate, _decorate_with_warning