code: def _expand_kwargs(kwargs, multiindex):
      """
      Most arguments to the plot functions must be a (single) value, or a sequence
      of values. This function checks each key-value pair in 'kwargs' and expands
      it (in place) to the correct length/formats with help of 'multiindex', unless
      the value appears to already be a valid (single) value for the key.
      """
      from matplotlib.colors import is_color_like
      from typing import Iterable
  
      scalar_kwargs = ["marker", "path_effects"]
      for att, value in kwargs.items():
          if "color" in att:  # color(s), edgecolor(s), facecolor(s)
              if is_color_like(value):
                  continue
          elif "linestyle" in att:  # linestyle(s)
              # A single linestyle can be 2-tuple of a number and an iterable.
              if (
                  isinstance(value, tuple)
                  and len(value) == 2
                  and isinstance(value[1], Iterable)
              ):
                  continue
          elif att in scalar_kwargs:
              # For these attributes, only a single value is allowed, so never expand.
              continue
  
          if pd.api.types.is_list_like(value):
              kwargs[att] = np.take(value, multiindex, axis=0)
  
imports: import warnings
  import numpy
  import pandas
  from pandas.plotting import PlotAccessor
  from pandas import CategoricalDtype
  import geopandas
  from packaging.version import Version
  from ._decorator import doc
label_desc: Use image node_id 3 for calling a global function with example usage: _expand_kwargs(kwargs, multiindex) without return types