def METHOD_NAME(N=10, ndim=2):
    d = ndim - 1
    np.random.seed(10)
    pts = np.random.rand(N, ndim).astype("float64")
    q, idx = utils.py_pivot(pts, d)
    if N == 0:
        np.testing.assert_equal(q, -1)
    else:
        piv = pts[idx[q], d]
        nmax = 7 * N / 10 + 6
        assert_less_equal(np.sum(pts[:, d] < piv), nmax)
        assert_less_equal(np.sum(pts[:, d] > piv), nmax)