code: def _flushContour(self):
          
          self.contours.append(
              dict(identifier=self._contourIdentifier, points=[])
          )
          contourPoints = self.contours[-1]["points"]
          points = self._points
          # move offcurves at the beginning of the contour to the end
          haveOnCurve = False
          for point in points:
              if point[0] is not None:
                  haveOnCurve = True
                  break
          if haveOnCurve:
              while 1:
                  if points[0][0] is None:
                      point = points.pop(0)
                      points.append(point)
                  else:
                      break
          # convert lines to curves
          holdingOffCurves = []
          for index, point in enumerate(points):
              segmentType = point[0]
              if segmentType == "line":
                  pt, smooth, name, identifier = point[1:]
                  prevPt = points[index - 1][1]
                  if index == 0:
                      holdingOffCurves.append((None, prevPt, False, None, None))
                      holdingOffCurves.append((None, pt, False, None, None))
                  else:
                      contourPoints.append((None, prevPt, False, None, None))
                      contourPoints.append((None, pt, False, None, None))
                  contourPoints.append(("curve", pt, smooth, name, identifier))
              else:
                  contourPoints.append(point)
          contourPoints.extend(holdingOffCurves)
docs: This normalizes the contour so that:
          - there are no line segments. in their place will be
            curve segments with the off curves positioned on top
            of the previous on curve and the new curve on curve.
          - the contour starts with an on curve