Creating A Python Apply Functions