code: def deprecated(message: str, stacklevel: int = 2):
      """
      Raise a [`DeprecationWarning`][] when wrapped function/method is called.
  
      Usage:
  
      ```python
      @deprecated("This method will be removed in version X; use Y instead.")
      def some_method():
          pass
      ```
      """
  
      def wrapper(func):
          @wraps(func)
          def deprecated_func(*args, **kwargs):
              warnings.warn(
                  f"'{func.__name__}' is deprecated. {message}",
                  category=DeprecationWarning,
                  stacklevel=stacklevel,
              )
              return func(*args, **kwargs)
  
          return deprecated_func
  
      return wrapper
  
imports: from __future__ import annotations
  import re
  import sys
  import warnings
  from functools import wraps, lru_cache
  from itertools import count
  from typing import TYPE_CHECKING, Generic, Iterator, NamedTuple, TypeVar, TypedDict, overload
label_desc: Use image node_id 2 for calling a global function with example usage: deprecated(message, stacklevel) and returns: wrapper, deprecated_func, func