code: def some(args):
      
      p = OptionParser(some.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) not in (2, 3):
          sys.exit(not p.print_help())
  
      idsfile, afastq, = args[:2]
      bfastq = args[2] if len(args) == 3 else None
  
      ids = DictFile(idsfile, valuepos=None)
  
      ai = iter_fastq(open(afastq))
      arec = next(ai)
      if bfastq:
          bi = iter_fastq(open(bfastq))
          brec = next(bi)
  
      while arec:
          if arec.name[1:] in ids:
              print(arec)
              if bfastq:
                  print(brec)
  
          arec = next(ai)
          if bfastq:
              brec = next(bi)
docs: %prog some idsfile afastq [bfastq]
  
      Select a subset of the reads with ids present in the idsfile.
      `bfastq` is optional (only if reads are paired)