class_docstr: A filter pen to convert quadratic bezier splines to cubic curves
  using the FontTools SegmentPen protocol.
  
  Args:
  
      other_pen: another SegmentPen 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: flip the contours' direction but keep starting point.
      stats: a dictionary counting the point numbers of cubic segments.
code: def filterContour(self, contour):
      quadratics = []
      currentPt = None
      newContour = []
      for op, args in contour:
          if op == "qCurveTo" and (
              self.all_cubic or (len(args) > 2 and args[-1] is not None)
          ):
              if args[-1] is None:
                  raise NotImplementedError(
                      "oncurve-less contours with all_cubic not implemented"
                  )
              quadratics.append((currentPt,) + args)
          else:
              if quadratics:
                  newContour.extend(
                      self._quadratics_to_curve(quadratics)
                  )
                  quadratics = []
              newContour.append((op, args))
          currentPt = args[-1] if args else None
      if quadratics:
          newContour.extend(self._quadratics_to_curve(quadratics))
  
      if not self.all_cubic:
          # Add back implicit oncurve points
          contour = newContour
          newContour = []
          for op, args in contour:
              if (
                  op == "qCurveTo"
                  and newContour
                  and newContour[-1][0] == "qCurveTo"
              ):
                  pt0 = newContour[-1][1][-2]
                  pt1 = newContour[-1][1][-1]
                  pt2 = args[0]
                  if (
                      pt1 is not None
                      and math.isclose(pt2[0] - pt1[0], pt1[0] - pt0[0])
                      and math.isclose(pt2[1] - pt1[1], pt1[1] - pt0[1])
                  ):
                      newArgs = newContour[-1][1][:-1] + args
                      newContour[-1] = (op, newArgs)
                      continue
  
              newContour.append((op, args))
  
      return newContour
  
file_path: catboost/contrib/python/fonttools/fontTools/pens/qu2cuPen.py
imports: from fontTools.qu2cu import quadratic_to_curves
  from fontTools.pens.filterPen import ContourFilterPen
  from fontTools.pens.reverseContourPen import ReverseContourPen
  import math
label_desc: Use image node_id 3 for calling the Qu2CuPen obj's underlying member method code with example usage: obj.filterContour(contour) and returns: newContour