def memoize(f):
cache = {}<EOL>@wraps(f)<EOL>def inner(arg):<EOL><INDENT>if arg not in cache:<EOL><INDENT>cache[arg] = f(arg)<EOL><DEDENT>return cache[arg]<EOL><DEDENT>return inner<EOL>
Decorator which caches function's return value each it is called.
    If called later with same arguments, the cached value is returned.