writenames = 'test,QC,Plate,Sample'.split(',')
reader = csv.reader(input_file_handle)
writer = csv.writer(output_file_handle)
readnames = next(reader)
name2index = dict((name, index) for index, name in enumerate(readnames))
writeindices = [name2index[name] for name in writenames]
reorderfunc = operator.itemgetter(*writeindices)
writer.writerow(writenames)
for row in reader:
    writer.writerow(reorderfunc(row))
write CSV columns out in a different order in Python