code: def removeSegment(self, segment, preserveCurve=False):
          
          if not isinstance(segment, int):
              segment = self.segments.index(segment)
          segment = normalizers.normalizeIndex(segment)
          if segment >= self._len__segments():
              raise ValueError("No segment located at index %d." % segment)
          preserveCurve = normalizers.normalizeBoolean(preserveCurve)
          self._removeSegment(segment, preserveCurve)
docs: Remove segment from the contour.
          If ``preserveCurve`` is set to ``True`` an attempt
          will be made to preserve the shape of the curve
          if the environment supports that functionality.