code: def deprecated(
      deprecated_in: str,
      removed_in: str = "",
      reasons: Tuple[str, ...] = (),
      raise_exception: bool = False,
  ) -> Callable:
      F = TypeVar("F", bound=Callable[..., Any])
  
      def decorator(func: F) -> F:
          func_doc = func.__doc__ if func.__doc__ else ""
          deprecation_warning = (
              f"This function has been deprecated since version {deprecated_in}"
              + (
                  f" and will be removed in version {removed_in}"
                  if removed_in
                  else ""
              )
              + ".\n Please refer to the documentation for more details."
          )
  
          @functools.wraps(func)
          def wrapper(*args: Any, **kwargs: Dict[str, Any]) -> Callable:
              if raise_exception:
                  raise DeprecationWarning(deprecation_warning)
              warnings.warn(
                  deprecation_warning, DeprecationWarning, stacklevel=2
              )
              return func(*args, **kwargs)
  
          appended_doc = f".. deprecated:: {deprecated_in}" + (
              "\n\n\t" if len(reasons) > 0 else ""
          )
  
          for reason in reasons:
              appended_doc += "\n\t- " + reason
          wrapper.__doc__ = f"**Deprecated function**.\n\n    {func_doc}{appended_doc}"
          return cast(F, wrapper)
  
      return decorator
  
imports: import collections.abc
  import functools
  import hashlib
  import logging
  import random
  import shutil
  import warnings
  from pathlib import Path
  from typing import Any, Callable, cast, Dict, List, Optional, TextIO, Tuple, Type, TypeVar, Union
  import torch
label_desc: Use image node_id 9 for calling a global function with example usage: deprecated(deprecated_in, removed_in, reasons, raise_exception) and returns: decorator, cast, func