def scale_mesh(mesh):
    """Scale normalize the input mesh to be centered at (0,0,0) and fits in a sphere of 1
    """
    verts = mesh.verts_packed()
    N = verts.shape[0]
    center = verts.mean(0)
    scale = max((verts - center).abs().max(0)[0])
    mesh.offset_verts_(-center.expand(N, 3))
    mesh.scale_verts_((1.0 / float(scale)))

    return mesh