code: def _rename_kwargs(
      func_name: str,
      kwargs: Dict[str, Any],
      kwargs_mapping: Dict[str, str],
      custom_warning_msg: Optional[str] = None,
      version_to_remove: Optional[str] = None,
      error: bool = False,
  ):
      for old_name, new_name in kwargs_mapping.items():
          if old_name in kwargs:
              if new_name is not None and new_name in kwargs:
                  raise ValueError(
                      f"{func_name} received both {old_name} and {new_name} as arguments."
                      f"{old_name} is deprecated, please use {new_name} instead."
                  )
              print(error)
              _deprecation_warning(
                  old=old_name,
                  new=new_name,
                  custom_warning_msg=custom_warning_msg,
                  version_to_remove=version_to_remove,
                  error=error,
              )
              if new_name is not None:
                  kwargs[new_name] = kwargs.pop(old_name)
  
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 3 for calling a global function with example usage: _rename_kwargs(func_name, kwargs, kwargs_mapping, custom_warning_msg, version_to_remove, error) without return types