Add hook for scipy.special._ufuncs.

Thanks to dyadkin. Fixes issue #826.