code: def deprecated_params(deprecations):
      old = deprecations.keys()
  
      def decorator(fn):
          fn_name = fullname(fn)
  
          @wraps(fn)
          def wrapper(*args, **kwargs):
              new_kwargs = {}
              keys = set(kwargs.keys())
              messages = []
              for k, v in kwargs.items():
                  if k in old:
                      new = deprecations[k]
                      new_tup = (
                          ((lambda ov: None), None)
                          if new in [None, ()]
                          else ((lambda ov: {new: ov}), None)
                          if isinstance(new, str_type)
                          else (new, None)
                          if callable(new)
                          else ((lambda ov: None), new[1])
                          if isinstance(new, tuple) and new[0] is None
                          else ((lambda ov: {new[0]: ov}), new[1])
                          if isinstance(new, tuple)
                          and isinstance(new[0], str_type)
                          else new
                      )
                      assert isinstance(new_tup, tuple), (
                          "`deprecations` values must be one of: "
                          "None (deprecated param removed), a string (deprecated property renamed), "
                          "a tuple(new_name: Optional[str], message: str) to customize the deprecation message, "
                          "a callable lambda old_value: dict(param1=value1, param2=value2) for advanced deprecations "
                          "(one param replaced with one or more params with transformation of the deprecated value), "
                          "or a tuple(lambda old_value: dict(param1=value1, param2=value2), message: str)."
                      )
                      transform_fn, msg = new_tup
                      new_params = transform_fn(v)
                      if new_params in [None, {}]:
                          messages.append(
                              msg
                              or "``{}`` param of ``{}`` is deprecated and will be ignored.".format(
                                  k, fn_name
                              )
                          )
                      else:
                          assert isinstance(new_params, dict)
                          messages.append(
                              msg
                              or "``{}`` param of ``{}`` is deprecated, please use ``{}`` instead.".format(
                                  k,
                                  fn_name,
                                  ", ".join(new_params.keys()),
                              )
                          )
                          intersect = set(new_params.keys()) & keys
                          if any(intersect):
                              messages.append(
                                  "Using both deprecated param ``{}`` and new param(s) ``{}`` in call to ``{}``, "
                                  "the deprecated param will be ignored.".format(
                                      k, ", ".join(intersect), fn_name
                                  )
                              )
                          else:
                              new_kwargs.update(new_params)
                  else:
                      new_kwargs[k] = v
              for msg in messages:
                  warnings.warn(msg, H2ODeprecationWarning, 2)
              return fn(*args, **new_kwargs)
  
          _set_decoration_info(wrapper, fn, "deprecation")
  
          return wrapper
  
      return decorator
  
imports: from h2o.utils.compatibility import *
  from functools import wraps
  import inspect
  import warnings
  from h2o.exceptions import H2ODeprecationWarning
label_desc: Use image node_id 6 for calling a global function with example usage: deprecated_params(deprecations) and returns: decorator, wrapper, fn