def pprint(ast):
    """pretty print an Abstract Syntax Tree"""

    def red(string):
        # format a string to be printed in red
        return '\033[31m' + string + '\033[0m'

    def print_rec(ast, i):
        # recursively print the AST
        if ast[0] == "symb" or ast[0] == 'value':
            print("  "*i + str(ast[1]))
        elif ast[0] == "non":
            print("  "*i + red(ast[0]))
            print_rec(ast[1], i+1)
        else:
            print("  "*i + red(ast[0]))
            print_rec(ast[1], i+1)
            print_rec(ast[2], i+1)

    print_rec(ast, 0)