Introduce functools.memoized decorator