def _as_nested_lists(vertices):
    """ Convert a nested structure such as an ndarray into a list of lists. """
    out = []
    for part in vertices:
        if hasattr(part[0], "__iter__"):
            verts = _as_nested_lists(part)
            out.append(verts)
        else:
            out.append(list(part))
    return out