docs: def _paint_colorbar_legend(ax, values, cmap, legend_kwargs):
      """
      Creates a legend and attaches it to the axis. Meant to be used when a ``legend=True`` parameter is passed.
  
      Parameters
      ----------
      ax : matplotlib.Axes instance
          The ``matplotlib.Axes`` instance on which a legend is being painted.
      values : list
          A list of values being plotted. May be either a list of int types or a list of unique entities in the
          data column (e.g. as generated via ``numpy.unique(data)``. This parameter is meant to be the same as that
          returned by the ``_discrete_colorize`` method.
      cmap : ``matplotlib.cm`` instance
          The `matplotlib` colormap instance which will be used to colorize the legend entries. This should be the
          same one used for colorizing the plot's geometries.
      legend_kwargs : dict
          Keyword arguments which will be passed to the matplotlib legend instance on initialization. This parameter
          is provided to allow fine-tuning of legend placement at the top level of a plot method, as legends are very
          finicky.
  
      Returns
      -------
      None.
      """
      if legend_kwargs is None: legend_kwargs = dict()
      cmap.set_array(values)
      plt.gcf().colorbar(cmap, ax=ax, **legend_kwargs)