def p_testlist_multi(p):
 if (len(p) == 2):
  p[0] = p[1]
 elif isinstance(p[1], list):
  p[0] = (p[1] + [p[3]])
 else:
  p[0] = [p[1], p[3]]

def p_testlist_multi ( p ) : if ( len ( p ) == 2 ) : p [ 0 ] = p [ 1 ] elif isinstance ( p [ 1 ] , list ) : p [ 0 ] = ( p [ 1 ] + [ p [ 3 ] ] ) else : p [ 0 ] = [ p [ 1 ] , p [ 3 ] ]
testlist_multi : testlist_multi comma test | test .