def memoize_lookuptable(func, *args, **kwargs):
    """A decorator that memoizes the results of a decorated function.
    Instead of checking if key is in keys, it attempts to access the
    property directly, like a typical lookup table."""
    funcname = func.__name__

    @wraps(func)
    def _inner(*args, **kwargs):
        key = (funcname, args)
        try:
            key = (funcname, args)
            return memoized[key]
        except __HOLE__:
            res = func(*args, **kwargs)
            memoized[key] = res
            return res
    return _inner
dataset/ETHPy150Open christabor/MoAL/MOAL/maths/applied/optimization/memoization.py/memoize_lookuptable