How To Cache A Function In Python