class_docstr: A filter pen to convert cubic bezier curves to quadratic b-splines
  using the FontTools PointPen protocol.
  
  Args:
      other_point_pen: another PointPen used to draw the transformed outline.
      max_err: maximum approximation error in font units. For optimal results,
          if you know the UPEM of the font, we recommend setting this to a
          value equal, or close to UPEM / 1000.
      reverse_direction: reverse the winding direction of all contours.
      stats: a dictionary counting the point numbers of quadratic segments.
      all_quadratic: if True (default), only quadratic b-splines are generated.
          if False, quadratic curves or cubic curves are generated depending
          on which one is more economical.
code: def _flushContour(self, segments):
      assert len(segments) >= 1
      closed = segments[0][0] != "move"
      new_segments = []
      prev_points = segments[-1][1]
      prev_on_curve = prev_points[-1][0]
      for segment_type, points in segments:
          if segment_type == "curve":
              for sub_points in self._split_super_bezier_segments(
                  points
              ):
                  on_curve, smooth, name, kwargs = sub_points[-1]
                  bcp1, bcp2 = sub_points[0][0], sub_points[1][0]
                  cubic = [prev_on_curve, bcp1, bcp2, on_curve]
                  quad = curve_to_quadratic(
                      cubic, self.max_err, self.all_quadratic
                  )
                  if self.stats is not None:
                      n = str(len(quad) - 2)
                      self.stats[n] = self.stats.get(n, 0) + 1
                  new_points = [
                      (pt, False, None, {}) for pt in quad[1:-1]
                  ]
                  new_points.append((on_curve, smooth, name, kwargs))
                  if self.all_quadratic or len(new_points) == 2:
                      new_segments.append(["qcurve", new_points])
                  else:
                      new_segments.append(["curve", new_points])
                  prev_on_curve = sub_points[-1][0]
          else:
              new_segments.append([segment_type, points])
              prev_on_curve = points[-1][0]
      if closed:
          # the BasePointToSegmentPen.endPath method that calls _flushContour
          # rotates the point list of closed contours so that they end with
          # the first on-curve point. We restore the original starting point.
          new_segments = new_segments[-1:] + new_segments[:-1]
      self._drawPoints(new_segments)
  
imports: import operator
  from fontTools.cu2qu import curve_to_quadratic, curves_to_quadratic
  from fontTools.pens.basePen import decomposeSuperBezierSegment
  from fontTools.pens.filterPen import FilterPen
  from fontTools.pens.reverseContourPen import ReverseContourPen
  from fontTools.pens.pointPen import BasePointToSegmentPen
  from fontTools.pens.pointPen import ReverseContourPointPen
label_desc: Use image node_id 2 for calling the Cu2QuPointPen obj's underlying member method code with example usage: obj._flushContour(segments) without return types