def _flatten(vertices):
    """ Convert a nested list of coordinates into a flat list. """
    out = []
    for item in vertices:
        if hasattr(item[0], "__iter__"):
            verts = _flatten(item)
            out.extend(verts)
        else:
            out.append(item)
    return out