def max_xyz(vertices, xyz):
    """Get the max vertices in the specified dimension from a list, x=0,y=1,z=2"""
    vals = []
    # Collect all the vertices of the correct type together
    for k in vertices:
        vals.append(k[xyz])
    # Find the highest value (may be more than one instance)
    max_val = max(vals)
    max_vertices = []
    while vals.count(max_val):
        i = vals.index(max_val)
        vals[i] = None
        max_vertices.append(vertices[i])
    return max_vertices