code: def _create_centerline(self):
          
          border = array(self.__densify_border())
  
          vor = Voronoi(border)
          vertex = vor.vertices
  
          lst_lines = []
          for j, ridge in enumerate(vor.ridge_vertices):
              if -1 not in ridge:
                  line = LineString([
                      (vertex[ridge[0]][0] + self._minx,
                       vertex[ridge[0]][1] + self._miny),
                      (vertex[ridge[1]][0] + self._minx,
                       vertex[ridge[1]][1] + self._miny)])
  
                  if line.within(self._input_geom) and len(line.coords[0]) > 1:
                      lst_lines.append(line)
  
          nr_lines = len(lst_lines)
          if nr_lines < 2:
              raise RuntimeError((
                  "Number of produced ridges is too small: {}"
                  ", this might be caused by too large interpolation distance."
              ).format(nr_lines))
  
          return unary_union(lst_lines)
docs: Calculate the centerline of a polygon.
  
          Densifies the border of a polygon which is then represented by a Numpy
          array of points necessary for creating the Voronoi diagram. Once the
          diagram is created, the ridges located within the polygon are
          joined and returned.
  
          Returns:
              a union of lines that are located within the polygon.