class_docstr: Custom Handler for LineCollection instances.
code: def create_artists(
      self,
      legend,
      orig_handle,
      xdescent,
      ydescent,
      width,
      height,
      fontsize,
      trans,
  ):
      # figure out how many lines there are
      numlines = len(orig_handle.get_segments())
      xdata, xdata_marker = self.get_xdata(
          legend, xdescent, ydescent, width, height, fontsize
      )
      leglines = []
      # divide the vertical space where the lines will go
      # into equal parts based on the number of lines
      ydata = np.full_like(xdata, height / (numlines + 1))
      # for each line, create the line at the proper location
      # and set the dash pattern
      for i in range(numlines):
          legline = Line2D(xdata, ydata * (numlines - i) - ydescent)
          self.update_prop(legline, orig_handle, legend)
          # set color, dash pattern, and linewidth to that
          # of the lines in linecollection
          try:
              color = orig_handle.get_colors()[i]
          except IndexError:
              color = orig_handle.get_colors()[0]
          try:
              dashes = orig_handle.get_dashes()[i]
          except IndexError:
              dashes = orig_handle.get_dashes()[0]
          try:
              lw = orig_handle.get_linewidths()[i]
          except IndexError:
              lw = orig_handle.get_linewidths()[0]
          if dashes[1] is not None:
              legline.set_dashes(dashes[1])
          legline.set_color(color)
          legline.set_transform(trans)
          legline.set_linewidth(lw)
          leglines.append(legline)
      return leglines
  
file_path: matplotlib/galleries/examples/text_labels_and_annotations/legend_demo.py
imports: import matplotlib.pyplot
  import numpy
  import matplotlib.collections
  from matplotlib.legend_handler import HandlerLineCollection, HandlerTuple
  from matplotlib.lines import Line2D
label_desc: Use image node_id 1 for calling the HandlerDashedLines obj's underlying member method code with example usage: obj.create_artists(legend, orig_handle, xdescent, ydescent, width, height, fontsize, trans) and returns: leglines