def _validate_close(self, vertex):
     # close the polygon
     if not self._open_loop:
         raise AssertionError(
             'invalid polygon: CLOSE vertex when loop close')
     if self._lines < 2:
         raise AssertionError('invalid polygon: minimum 2 lines required')
     self._open_loop = False
     # SphericalPolygon requires point[0] == point[-1]
     point = self._polygon.points[0]
     self._polygon.points.append(Point(point.cval1, point.cval2))
     # validate the polygons in the multipolygon
     validate_polygon(self._polygon)
     # instantiate a new Polygon for the next iteration
     self._polygon = Polygon()
 def __init__(self):
     self._lines = 0
     self._open_loop = False
     self._polygon = Polygon()