code: def deprecate_kwarg(
      old_name: str,
      new_name: t.Optional[str] = None,
  ) -> t.Callable[[F], F]:
      """Decorate a function with deprecated kwargs.
  
      Parameters
      ----------
      old_arg_name : str
          Name of argument in function to deprecate
      new_arg_name : Optional[str], default None
          Name of preferred argument in function.
      """
  
      def _deprecate_kwarg(func: F) -> F:
          @wraps(func)
          def wrapper(*args, **kwargs) -> t.Callable[..., t.Any]:
              if old_name in kwargs and new_name in kwargs:
                  raise TypeError(
                      f"Can only specify {repr(old_name)} "
                      f"or {repr(new_name)}, not both"
                  )
              elif old_name in kwargs and new_name is None:
                  get_logger().warning(
                      "the %s keyword is deprecated and "
                      "will be removed in a future version. Please take "
                      "steps to stop the use of %s",
                      repr(old_name),
                      repr(old_name),
                  )
              elif old_name in kwargs and new_name is not None:
                  get_logger().warning(
                      "the %s keyword is deprecated, " "use %s instead",
                      repr(old_name),
                      repr(new_name),
                  )
                  kwargs[new_name] = kwargs.pop(old_name)
              return func(*args, **kwargs)
  
          return t.cast(F, wrapper)
  
      return _deprecate_kwarg
  
file_path: deepchecks/deepchecks/utils/decorators.py
imports: import textwrap
  import typing
  from functools import wraps
  from deepchecks.utils.logger import get_logger
label_desc: Use image node_id 2 for calling a global function with example usage: deprecate_kwarg(old_name, new_name) and returns: _deprecate_kwarg, t, func