code: def fastq_to_csv(in_file, fastq_format, work_dir):
      
      out_file = "%s.csv" % (os.path.splitext(os.path.basename(in_file))[0])
      out_file = os.path.join(work_dir, out_file)
      if not (os.path.exists(out_file) and os.path.getsize(out_file) > 0):
          with open(in_file) as in_handle:
              with open(out_file, "w") as out_handle:
                  writer = csv.writer(out_handle)
                  for rec in SeqIO.parse(in_handle, fastq_format):
                      writer.writerow([rec.id] + rec.letter_annotations["phred_quality"])
      return out_file
docs: Convert a fastq file into a CSV of phred quality scores.