code: def deprecated(help_message: Optional[str] = None):
      """Decorator to mark a class or a function as deprecated.
  
      Args:
          help_message (:obj:`str`, optional): An optional message to guide the user on how to
              switch to non-deprecated usage of the library.
      """
  
      def decorator(deprecated_class_or_function: Callable):
          global _emitted_deprecation_warnings
  
          if inspect.isclass(deprecated_class_or_function):
              deprecated_function = (
                  deprecated_class_or_function.__init__
              )
              name = deprecated_class_or_function.__name__
          else:
              deprecated_function = deprecated_class_or_function
              name = deprecated_function.__name__
              # Support deprecating __init__ class method: class name instead
              name = (
                  name
                  if name != "__init__"
                  else deprecated_function.__qualname__.split(".")[-2]
              )
  
          warning_msg = (
              f"{name} is deprecated and will be removed in the next major version of datasets."
              + f" {help_message}"
              if help_message
              else ""
          )
  
          @wraps(deprecated_function)
          def wrapper(*args, **kwargs):
              func_hash = hash(deprecated_function)
              if func_hash not in _emitted_deprecation_warnings:
                  warnings.warn(
                      warning_msg, category=FutureWarning, stacklevel=2
                  )
                  _emitted_deprecation_warnings.add(func_hash)
              return deprecated_function(*args, **kwargs)
  
          wrapper._decorator_name_ = "deprecated"
  
          if inspect.isclass(deprecated_class_or_function):
              deprecated_class_or_function.__init__ = wrapper
              return deprecated_class_or_function
          else:
              return wrapper
  
      return decorator
  
file_path: datasets/src/datasets/utils/deprecation_utils.py
imports: import enum
  import inspect
  import warnings
  from functools import wraps
  from typing import Callable, Optional
  from .logging import get_logger
label_desc: Use image node_id 1 for calling a global function with example usage: deprecated(help_message) and returns: decorator, deprecated_function, deprecated_class_or_function, wrapper