code: def _get_legend_handles(axs, legend_handler_map=None):
      """Yield artists that can be used as handles in a legend."""
      handles_original = []
      for ax in axs:
          handles_original += [
              *(
                  a
                  for a in ax._children
                  if isinstance(a, (Line2D, Patch, Collection, Text))
              ),
              *ax.containers,
          ]
          # support parasite Axes:
          if hasattr(ax, "parasites"):
              for axx in ax.parasites:
                  handles_original += [
                      *(
                          a
                          for a in axx._children
                          if isinstance(
                              a, (Line2D, Patch, Collection, Text)
                          )
                      ),
                      *axx.containers,
                  ]
  
      handler_map = {
          **Legend.get_default_handler_map(),
          **(legend_handler_map or {}),
      }
      has_handler = Legend.get_legend_handler
      for handle in handles_original:
          label = handle.get_label()
          if label != "_nolegend_" and has_handler(handler_map, handle):
              yield handle
          elif (
              label
              and not label.startswith("_")
              and not has_handler(handler_map, handle)
          ):
              _api.warn_external(
                  "Legend does not support handles for "
                  f"{type(handle).__name__} "
                  "instances.\nSee: https://matplotlib.org/stable/"
                  "tutorials/intermediate/legend_guide.html"
                  "#implementing-a-custom-legend-handler"
              )
              continue
  
imports: import itertools
  import logging
  import numbers
  import time
  import numpy
  import matplotlib
  from matplotlib import _api, _docstring, cbook, colors, offsetbox
  from matplotlib.artist import Artist, allow_rasterization
  from matplotlib.cbook import silent_list
  from matplotlib.font_manager import FontProperties
  from matplotlib.lines import Line2D
  from matplotlib.patches import Patch, Rectangle, Shadow, FancyBboxPatch, StepPatch
  from matplotlib.collections import Collection, CircleCollection, LineCollection, PathCollection, PolyCollection, RegularPolyCollection
  from matplotlib.text import Text
  from matplotlib.transforms import Bbox, BboxBase, TransformedBbox
  from matplotlib.transforms import BboxTransformTo, BboxTransformFrom
  from matplotlib.offsetbox import AnchoredOffsetbox, DraggableOffsetBox, HPacker, VPacker, DrawingArea, TextArea
  from matplotlib.container import ErrorbarContainer, BarContainer, StemContainer
  from .None import legend_handler
label_desc: Use image node_id 1 for calling a global function with example usage: _get_legend_handles(axs, legend_handler_map) without return types