code: def format(args):
      
      p = OptionParser(format.__doc__)
  
      p.add_option("--convert", default=None, choices=[">=1.8", "<1.8", "sra"],
                  help="Convert fastq header to a different format" +
                  " [default: %default]")
      p.set_tag(specify_tag=True)
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      fastqfile, = args
      ai = iter_fastq(fastqfile)
      rec = next(ai)
      dialect = None
      while rec:
          h = FastqHeader(rec.header)
          if not dialect:
              dialect = h.dialect
              logging.debug("Input fastq dialect: `{0}`".format(dialect))
              if opts.convert:
                  logging.debug("Output fastq dialect: `{0}`".format(opts.convert))
  
          rec.name = h.format_header(dialect=opts.convert, tag=opts.tag)
  
          print(rec)
          rec = next(ai)
docs: %prog format fastqfile
  
      Format FASTQ file. Currently provides option to convert FASTQ header from
      one dialect to another.