code: def write(self, read, unique_id=None, umi=None, unmapped=False):
          '''Check if chromosome has changed since last time. If it has, scan
          for mates. Write the read to outfile and save the identity for paired
          end retrieval'''
  
          if unmapped or read.mate_is_unmapped:
              self.outfile.write(read)
              return
  
          if not self.chrom == read.reference_name:
              self.write_mates()
              self.chrom = read.reference_name
  
          key = read.query_name, read.next_reference_name, read.next_reference_start
          self.read1s.add(key)
  
          self.outfile.write(readf write(self, read, unique_id=None, umi=None, unmapped=False):
          '''Check if chromosome has changed since last time. If it has, scan
          for mates. Write the read to outfile and save the identity for paired
          end retrieval'''
  
          if unmapped or read.mate_is_unmapped:
              self.outfile.write(read)
              return
  
          if not self.chrom == read.reference_name:
              self.write_mates()
              self.chrom = read.reference_name
  
          key = read.query_name, read.next_reference_name, read.next_reference_start
          self.read1s.add(key)
  
          self.outfile.write(read)
docs: Check if chromosome has changed since last time. If it has, scan
          for mates. Write the read to outfile and save the identity for paired
          end retrieval