def METHOD_NAME(ser, lookup):
    vtype, value = ser
    if vtype == "r":
        if e := lookup(value):
            yield e
    elif vtype == "c":
        for v in value:
            yield from METHOD_NAME(v, lookup)
    elif vtype == "v":
        yield value