@wrapt.decorator
def memoize(wrapped, instance, args, kwargs):
    if instance is None and inspect.isclass(wrapped):
        # Wrapped function is a class and we are creating an
        # instance of the class. Don't support this case, just
        # return straight away.

        return wrapped(*args, **kwargs)

    # Retrieve the cache, attaching an empty one if none exists.

    cache = wrapped.__dict__.setdefault('_memoize_cache', {})

    # Now see if entry is in the cache and if it isn't then call
    # the wrapped function to generate it.

    try:
        key = (args, frozenset(kwargs.items()))
        return cache[key]

    except __HOLE__:
        result = cache[key] = wrapped(*args, **kwargs)
        return result
dataset/ETHPy150Open GrahamDumpleton/wrapt/tests/test_memoize.py/memoize