def p_and_test(p):
    """and_test : not_test
                 | and_test AND not_test
                 | and_test BADAND not_test"""
    if len(p) == 2:
        p[0] = p[1]
    else:
        p[0] = ['MATHOP', 'and', p[1], p[3]]
