def memorize(func):
@wraps(func)<EOL>def wrapped_func(*args, **kwargs):<EOL><INDENT>if (len(args) > <NUM_LIT:0> and len(kwargs) > <NUM_LIT:0>): <EOL><INDENT>cacheKey = list(args)<EOL>cacheKey.append(kwargs)<EOL><DEDENT>elif (len(args) > <NUM_LIT:0>): <EOL><INDENT>cacheKey = args<EOL><DEDENT>else:<EOL><INDENT>cacheKey = func.__name__<EOL><DEDENT>global __cache__<EOL>result = __cache__.get(cacheKey)<EOL>if result is None:<EOL><INDENT>result = func(*args, **kwargs)<EOL>__cache__[cacheKey] = result<EOL><DEDENT>return result<EOL><DEDENT>return wrapped_func<EOL>
Simply memorize the calculated result :data:`func`. previously returned.

Simply cached all calculated results from the decorated method/function into
a global `dict`.