def memoize(func):
cache = {}<EOL>@wraps(func)<EOL>def wrap(*args, **kwargs):<EOL><INDENT>key = '<STR_LIT>'.format(args, kwargs)<EOL>if key not in cache:<EOL><INDENT>cache[key] = func(*args, **kwargs)<EOL><DEDENT>return cache[key]<EOL><DEDENT>return wrap<EOL>
Cache for heavy function calls.