def searchExpr(expr, begin):
    """Return a slice object that corresponds to the
    range of values that defines the subtree which has the
    element with index *begin* as its root.
    """
    end = begin + 1
    total = expr[begin].arity
    while total > 0:
        total += expr[end].arity - 1
        end += 1
    return slice(begin, end)
