Avoiding isinstance for checking for instance of tuple class

What could be a way to avoid isinstance in the following code, targeting to parse arbitrary logic consisting of (1) conditions, (2) and_ or or_ strings, (3) and nested tuples thereof like:

t = ["a","and_",("b",'or_','a'),'and_',('a','and_','b'),'or_','c']

# @njit
def _eval(d):
    while len(d) > 1:
        X = {"a": True, "b": False, "c": True}
        a, b, c = d[:3]
        d = d[3:]
        v1 = X[a] if a in X else (_eval(a) if isinstance(a, tuple) else a)
        v2 = X[c] if c in X else (_eval(c) if isinstance(c, tuple) else c)
        d = [v1 & v2 if b == "and_" else v1 | v2] + list(d)
    return d[0]
# True


hi! doing different things when receiving different types is something that generated_jit can do for you: Flexible specializations with @generated_jit — Numba 0.54.0.dev0+529.gd0ca288f2.dirty-py3.7-linux-x86_64.egg documentation