def rpn_to_ast(rpn):
    stack = []
for n in rpn:
    num_args = (2 if n.token.ttype == 'operator-infix' else 1 if n.token.
        ttype.startswith('operator') else n.num_args if n.token.ttype ==
        'function' else 0)
n.args = [stack.pop() for _ in range(num_args)][::-1]
stack.append(n)
return stack[0]
parsing excel style formula