How To Fold Up Function In Python