code: def _get_segments(self):
          
          points = list(self.points)
          segments = [[]]
          lastWasOffCurve = False
          firstIsMove = points[0].type == "move"
          for point in points:
              segments[-1].append(point)
              if point.type != "offcurve":
                  segments.append([])
              lastWasOffCurve = point.type == "offcurve"
          if len(segments[-1]) == 0:
              del segments[-1]
          if lastWasOffCurve and firstIsMove:
              # ignore trailing off curves
              del segments[-1]
          if lastWasOffCurve and not firstIsMove:
              segment = segments.pop(-1)
              segment.extend(segments[0])
              del segments[0]
              segments.append(segment)
          if not lastWasOffCurve and not firstIsMove:
              segment = segments.pop(0)
              segments.append(segment)
          # wrap into segments
          wrapped = []
          for points in segments:
              s = self.segmentClass()
              s._setPoints(points)
              self._setContourInSegment(s)
              wrapped.append(s)
          return wrapped
docs: Subclasses may override this method.