How To Package A Python Apply Function