def memoize(func, cache, num_args):
    def wrapper(*args):
        mem_args = args[:num_args]
        if mem_args in cache:
            return cache[mem_args]
        result = func(*args)
        cache[mem_args] = result
        return result
    return wraps(func)(wrapper)
Wrap a function so that results for any argument tuple are stored in
dataset/ETHPy150Open CollabQ/CollabQ/vendor/django/utils/functional.py/memoize