code: def _set_labels(series, labels, rendering_kw):
      """Apply the `label` and `rendering_kw` keyword arguments to the series."""
      if not isinstance(labels, (list, tuple)):
          labels = [labels]
      if len(labels) > 0:
          if len(labels) == 1 and len(series) > 1:
              # if one label is provided and multiple series are being plotted,
              # set the same label to all data series. It maintains
              # back-compatibility
              labels *= len(series)
          if len(series) != len(labels):
              raise ValueError(
                  "The number of labels must be equal to the "
                  "number of expressions being plotted.\nReceived "
                  f"{len(series)} expressions and {len(labels)} labels"
              )
  
          for s, l in zip(series, labels):
              s.label = l
  
      if rendering_kw:
          if isinstance(rendering_kw, dict):
              rendering_kw = [rendering_kw]
          if len(rendering_kw) == 1:
              rendering_kw *= len(series)
          elif len(series) != len(rendering_kw):
              raise ValueError(
                  "The number of rendering dictionaries must be "
                  "equal to the number of expressions being plotted.\nReceived "
                  f"{len(series)} expressions and {len(labels)} labels"
              )
          for s, r in zip(series, rendering_kw):
              s.rendering_kw = r
  
imports: from sympy.concrete.summations import Sum
  from sympy.core.containers import Tuple
  from sympy.core.expr import Expr
  from sympy.core.function import Function, AppliedUndef
  from sympy.core.symbol import Dummy, Symbol, Wild
  from sympy.external import import_module
  from sympy.functions import sign
  from sympy.plotting.backends.base_backend import Plot
  from sympy.plotting.backends.matplotlibbackend import MatplotlibBackend
  from sympy.plotting.backends.textbackend import TextBackend
  from sympy.plotting.series import LineOver1DRangeSeries, Parametric2DLineSeries, Parametric3DLineSeries, ParametricSurfaceSeries, SurfaceOver2DRangeSeries, ContourSeries
  from sympy.plotting.utils import _check_arguments, _plot_sympify
  from sympy.tensor.indexed import Indexed
  from sympy.plotting.plotgrid import PlotGrid
  from sympy.plotting.series import BaseSeries
  from sympy.plotting.series import Line2DBaseSeries
  from sympy.plotting.series import Line3DBaseSeries
  from sympy.plotting.series import SurfaceBaseSeries
  from sympy.plotting.series import List2DSeries
  from sympy.plotting.series import GenericDataSeries
  from sympy.plotting.series import centers_of_faces
  from sympy.plotting.series import centers_of_segments
  from sympy.plotting.series import flat
  from sympy.plotting.backends.base_backend import unset_show
  from sympy.plotting.backends.matplotlibbackend import _matplotlib_list
  from sympy.plotting.textplot import textplot
label_desc: Use image node_id 4 for calling a global function with example usage: _set_labels(series, labels, rendering_kw) without return types