def memoize(f):
    cache= {}
    def memf(*x):
        if x not in cache:
            cache[x] = f(*x)
        return cache[x]
    return memf
A simple memoize decorator for functions.
dataset/ETHPy150Open packages/psutil/psutil/_common.py/memoize