code: def unmapped(sam, mates):
      
      for read in sam:
          if read.startswith('@') is True:
              continue
          read = read.strip().split()
          if read[2] == '*' and read[6] == '*':
                  yield read
          elif mates is True:
              if read[2] == '*' or read[6] == '*':
                  yield read
              for i in read:
                  if i == 'YT:Z:UP':
                      yield read
docs: get unmapped reads