Perhaps helpful is a python implementation of the spherical harmonics (stolen from @andysim) here: https://github.com/dgasmith/gau2grid/blob/master/gau2grid/RSH.py
Perhaps too difficult to unwind, but we use the quantities directly in Psi4 so we are certain they are valid.