code: def _update_old_psd_kwargs(kwargs):
      """Modify passed-in kwargs to match new API.
  
      NOTE: using plot_raw_psd as fallback (even for epochs) is fine because
      their kwargs are the same (and will stay the same: both are @legacy funcs).
      """
      from ..viz import plot_raw_psd as fallback_fun
  
      may_change = ("axes", "alpha", "ci_alpha", "amplitude", "ci")
      for kwarg in may_change:
          if kwarg in kwargs:
              warn(
                  "The legacy plot_psd() method got an unexpected keyword argument "
                  f"'{kwarg}', which is a parameter of Spectrum.plot(). Try rewriting as "
                  f"object.compute_psd(...).plot(..., {kwarg}=<whatever>)."
              )
      kwargs.setdefault(
          "axes", _pop_with_fallback(kwargs, "ax", fallback_fun)
      )
      kwargs.setdefault(
          "alpha",
          _pop_with_fallback(kwargs, "line_alpha", fallback_fun),
      )
      kwargs.setdefault(
          "ci_alpha",
          _pop_with_fallback(kwargs, "area_alpha", fallback_fun),
      )
      est = _pop_with_fallback(kwargs, "estimate", fallback_fun)
      kwargs.setdefault(
          "amplitude", "auto" if est == "auto" else (est == "amplitude")
      )
      area_mode = _pop_with_fallback(kwargs, "area_mode", fallback_fun)
      kwargs.setdefault("ci", "sd" if area_mode == "std" else area_mode)
  
imports: from inspect import currentframe, getargvalues, signature
  from ..utils import warn
label_desc: Use image node_id 2 for calling a global function with example usage: _update_old_psd_kwargs(kwargs) without return types