def traverse(it, tree):
    """
    Return False, when it has no more elements,
    or the leave node resulting from traversing the tree
    """
    try:
        subtree = tree[it.next()]
    except __HOLE__:
        return False
    
    if isinstance(subtree, list) and len(subtree)==2:
        return traverse(it, subtree)
    else: # leave node
        return subtree
dataset/ETHPy150Open pearu/pylibtiff/libtiff/bitarray-0.3.5-numpy/examples/decoding.py/traverse