code: def _split_psd_kwargs(*, plot_fun=None, kwargs=None):
      from ..io import BaseRaw
      from ..time_frequency import Spectrum
  
      # if no kwargs supplied, get them from calling func
      if kwargs is None:
          frame = currentframe().f_back
          arginfo = getargvalues(frame)
          kwargs = {
              k: v
              for k, v in arginfo.locals.items()
              if k in arginfo.args
          }
          if arginfo.keywords is not None:  # add in **method_kw
              kwargs.update(arginfo.locals[arginfo.keywords])
  
      # for compatibility with `plot_raw_psd`, `plot_epochs_psd` and
      # `plot_epochs_psd_topomap` functions (not just the instance methods/mixin)
      if "raw" in kwargs:
          kwargs["self"] = kwargs.pop("raw")
      elif "epochs" in kwargs:
          kwargs["self"] = kwargs.pop("epochs")
  
      # `reject_by_annotation` not needed for Epochs or Evoked
      if not isinstance(kwargs.pop("self", None), BaseRaw):
          kwargs.pop("reject_by_annotation", None)
  
      # handle API changes from .plot_psd(...) to .compute_psd(...).plot(...)
      if plot_fun is Spectrum.plot:
          _update_old_psd_kwargs(kwargs)
  
      # split off the plotting kwargs
      plot_kwargs = {
          k: v
          for k, v in kwargs.items()
          if k in signature(plot_fun).parameters and k != "picks"
      }
      for k in plot_kwargs:
          del kwargs[k]
      return kwargs, plot_kwargs
  
imports: from inspect import currentframe, getargvalues, signature
  from ..utils import warn
label_desc: Use image node_id 3 for calling a global function with example usage: _split_psd_kwargs() and returns: kwargs,  plot_kwargs