code: def toVerticesAndPolygons(self):
          
          offset = 1.234567890
          verts = []
          polys = []
          vertexIndexMap = {}
          count = 0
          for poly in self.polygons:
              verts = poly.vertices
              cell = []
              for v in poly.vertices:
                  p = v.pos
                  # use string key to remove degeneracy associated
                  # very close points. The format %.10e ensures that
                  # points differing in the 11 digits and higher are 
                  # treated as the same. For instance 1.2e-10 and 
                  # 1.3e-10 are essentially the same.
                  vKey = '%.10e,%.10e,%.10e' % (p[0] + offset, 
                                                p[1] + offset, 
                                                p[2] + offset)
                  if not vKey in vertexIndexMap:
                      vertexIndexMap[vKey] = len(vertexIndexMap)
                  index = vertexIndexMap[vKey]
                  cell.append(index)
                  count += 1
              polys.append(cell)
          # sort by index
          sortedVertexIndex = sorted(vertexIndexMap.items(),
                                     key=operator.itemgetter(1))
          verts = []
          for v, i in sortedVertexIndex:
              p = []
              for c in v.split(','):
                  p.append(float(c) - offset)
              verts.append(tuple(p))
          return verts, polys, count
docs: Return list of vertices, polygons (cells), and the total
          number of vertex indices in the polygon connectivity list
          (count).