code: def filter_stream(fq, args):
      
      if args.quality:
          quality_check = ave_qual
      else:
          quality_check = silent_quality_check
      minlen = args.length + int(args.headcrop or 0) - (int(args.tailcrop or 0))
      for rec in SeqIO.parse(fq, "fastq"):
          if args.GC_filter:
              gc = (rec.seq.upper().count("C") + rec.seq.upper().count("G")) / len(rec)
          else:
              gc = 0.50  # dummy variable
          if quality_check(rec.letter_annotations["phred_quality"]) > args.quality \
                  and minlen <= len(rec) <= args.maxlength \
                  and args.minGC <= gc <= args.maxGC:
              print(rec[args.headcrop:args.tailcrop].format("fastq"), end="")
docs: Filter a fastq file on stdin.
  
      Print fastq record to stdout if it passes
      - quality filter (optional)
      - length filter (optional)
      - min/maxGC filter (optional)
      Optionally trim a number of nucleotides from beginning and end.
      Record has to be longer than args.length (default 1) after trimming
      Use a faster silent quality_check if no filtering on quality is required