import re

dbg = False

term_regex = r'''(?mx)
    \s*(?:
        (?P<brackl>\()|
        (?P<brackr>\))|
        (?P<num>\-?\d+\.\d+|\-?\d+)|
        (?P<sq>]*%-6s%-14s%-44s%-sterm value out stack%-7s%-14s%-44r%-rTrouble with nesting of bracketsError:%rTrouble with nesting of brackets%s', '\quoted data(moredata)\nParsed to Python:\nThen back to: '%s'"% print_sexp(parsed))