def quadratic(Ks, dim, rhos, required=None):
<EOL>N = rhos.shape[<NUM_LIT:0>]<EOL>Ks = np.asarray(Ks)<EOL>Bs = (Ks - <NUM_LIT:1>) / np.pi ** (dim / <NUM_LIT:2>) * gamma(dim / <NUM_LIT:2> + <NUM_LIT:1>)  <EOL>est = Bs / (N - <NUM_LIT:1>) * np.mean(rhos ** (-dim), axis=<NUM_LIT:0>)<EOL>return est<EOL>
r'''
    Estimates \int p^2 based on kNN distances.

    In here because it's used in the l2 distance, above.

    Returns array of shape (num_Ks,).