def _vmf_normalize(kappa, dim):
num = np.power(kappa, dim / <NUM_LIT> - <NUM_LIT:1.>)<EOL>if dim / <NUM_LIT> - <NUM_LIT:1.> < <NUM_LIT>:<EOL><INDENT>denom = np.power(<NUM_LIT> * np.pi, dim / <NUM_LIT>) * i0(kappa)<EOL><DEDENT>else:<EOL><INDENT>denom = np.power(<NUM_LIT> * np.pi, dim / <NUM_LIT>) * iv(dim / <NUM_LIT> - <NUM_LIT:1.>, kappa)<EOL><DEDENT>if np.isinf(num):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if np.isinf(denom):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if np.abs(denom) < <NUM_LIT>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>return num / denom<EOL>
Compute normalization constant using built-in numpy/scipy Bessel
    approximations.

    Works well on small kappa and mu.