def memoize(rule):
    """ Memoized version of a rule """
    cache = {}
    def memoized_rl(expr):
        if cache in expr:
            return cache[expr]
        else:
            result = rule(expr)
            cache[expr] = result
            return result
    return memoized_rl
dataset/ETHPy150Open sympy/sympy/sympy/strategies/core.py/memoize/swapped operands of `in`