See version in nipy.algorithms.kernel_smooth.  Maybe should go in nipy.utils, true.