def to_ast(s): print s tp = parse(s) print tp astb = ASTBuilder() astb.sourcename = "test" return astb.dispatch(tp)