code: def _handle_legend_field(label, legend, glyph_renderer):
      if not isinstance(label, str):
          raise ValueError("legend_field value must be a string")
      label = field(label)
      item = _find_legend_item(label, legend)
      if item:
          item.renderers.append(glyph_renderer)
      else:
          new_item = LegendItem(label=label, renderers=[glyph_renderer])
          legend.items.append(new_item)
  
file_path: bokeh/src/bokeh/plotting/_legends.py
imports: from __future__ import annotations
  import logging
  import numpy
  from ..core.properties import field, value
  from ..models import Legend, LegendItem
  from ..util.strings import nice_join
label_desc: Use image node_id 5 for calling a global function with example usage: _handle_legend_field(label, legend, glyph_renderer) without return types