added python memoization