code: def deprecated_class(
      deprecated_version: str,
      removed_version: str,
      name: Optional[str] = None,
      text: Optional[str] = None,
  ) -> "Callable[[CT], CT]":
      """Decorate class as deprecated.
  
      Args:
          deprecated_version:
              The version in which the target feature is deprecated.
          removed_version:
              The version in which the target feature will be removed.
          name:
              The name of the feature. Defaults to the class name. Optional.
          text:
              The additional text for the deprecation note. The default note is build using specified
              ``deprecated_version`` and ``removed_version``. If you want to provide additional
              information, please specify this argument yourself.
  
              .. note::
                  The default deprecation note is as follows: "Deprecated in v{d_ver}. This feature
                  will be removed in the future. The removal of this feature is currently scheduled
                  for v{r_ver}, but this schedule is subject to change. See
                  https://github.com/optuna/optuna/releases/tag/v{d_ver}."
  
              .. note::
                  The specified text is concatenated after the default deprecation note.
      """
  
      _validate_version(deprecated_version)
      _validate_version(removed_version)
      _validate_two_version(deprecated_version, removed_version)
  
      def decorator(cls: "CT") -> "CT":
          def wrapper(cls: "CT") -> "CT":
              """Decorates a class as deprecated.
  
              This decorator is supposed to be applied to the deprecated class.
              """
              _original_init = getattr(cls, "__init__")
              _original_name = getattr(cls, "__name__")
  
              @functools.wraps(_original_init)
              def wrapped_init(
                  self: Any, *args: Any, **kwargs: Any
              ) -> None:
                  message = _DEPRECATION_WARNING_TEMPLATE.format(
                      name=(
                          name if name is not None else _original_name
                      ),
                      d_ver=deprecated_version,
                      r_ver=removed_version,
                  )
                  if text is not None:
                      message += " " + text
                  warnings.warn(
                      message,
                      FutureWarning,
                      stacklevel=2,
                  )
  
                  _original_init(self, *args, **kwargs)
  
              setattr(cls, "__init__", wrapped_init)
  
              if cls.__doc__ is None:
                  cls.__doc__ = ""
  
              note = _DEPRECATION_NOTE_TEMPLATE.format(
                  d_ver=deprecated_version, r_ver=removed_version
              )
              if text is not None:
                  note += _format_text(text)
              indent = _get_docstring_indent(cls.__doc__)
              cls.__doc__ = (
                  cls.__doc__.strip()
                  + textwrap.indent(note, indent)
                  + indent
              )
  
              return cls
  
          return wrapper(cls)
  
      return decorator
  
file_path: optuna/optuna/_deprecated.py
imports: import functools
  import textwrap
  from typing import Any
  from typing import Callable
  from typing import Optional
  from typing import TYPE_CHECKING
  from typing import TypeVar
  import warnings
  from packaging import version
  from optuna._experimental import _get_docstring_indent
  from optuna._experimental import _validate_version
label_desc: Use image node_id 4 for calling a global function with example usage: deprecated_class(deprecated_version, removed_version, name, text) and returns: decorator, wrapper, cls