code: def parse_sam(sam, qual):
      
      for line in sam:
          if line.startswith('@'):
              continue
          line = line.strip().split()
          if int(line[4]) == 0 or int(line[4]) < qual:
              continue
          yield line
docs: parse sam file and check mapping quality