code: def _deprecation_warning(
      old: str,
      new: Optional[str] = None,
      custom_warning_msg: Optional[str] = None,
      version_to_remove: Optional[str] = None,
      error: bool = False,
  ):
      msg = custom_warning_msg
      if msg is None:
          msg = f"`{old}` has been deprecated"
          msg += (
              f" and will be removed in version {version_to_remove}. "
              if version_to_remove is not None
              else ". "
          )
          msg += (
              f"Please use `{new}` instead" if new is not None else ""
          )
  
      if error:
          raise ValueError(msg)
      else:
          warnings.warn(
              f"{msg}. This will raise an error in the future!",
              category=DeprecationWarning,
              stacklevel=3,
          )
  
file_path: autogluon/common/src/autogluon/common/utils/deprecated_utils.py
imports: import functools
  import inspect
  import warnings
  from typing import Any, Callable, Dict, Optional
  from packaging import version
  from ..version import __version__
label_desc: Use image node_id 1 for calling a global function with example usage: _deprecation_warning(old, new, custom_warning_msg, version_to_remove, error) without return types