code: def either_dict_or_kwargs(
      pos_kwargs,
      kw_kwargs,
      func_name,
  ):
      """Clone from xarray.core.utils."""
      if pos_kwargs is None:
          return kw_kwargs
      if not hasattr(pos_kwargs, "keys") and hasattr(
          pos_kwargs, "__getitem__"
      ):
          raise ValueError(
              f"the first argument to .{func_name} must be a dictionary"
          )
      if kw_kwargs:
          raise ValueError(
              f"cannot specify both keyword and positional arguments to .{func_name}"
          )
      return pos_kwargs
  
imports: import functools
  import importlib
  import importlib.resources
  import re
  import warnings
  from functools import lru_cache
  import matplotlib.pyplot
  import numpy
  from numpy import newaxis
  from .rcparams import rcParams
label_desc: Use image node_id 19 for calling a global function with example usage: either_dict_or_kwargs(pos_kwargs, kw_kwargs, func_name) and returns: pos_kwargs, kw_kwargs