code: def map_alignment(self, prot_seq, nucl_seq):
          
          if prot_seq.id != nucl_seq.id:
              logging.warning(
                  'ID mismatch: %s != %s. Are the sequences in the same order?',
                  prot_seq.id, nucl_seq.id)
  
          # Ungap nucleotides
          codons = batch(str(nucl_seq.seq.ungap('-')), 3)
          codons = [''.join(i) for i in codons]
          codon_iter = iter(codons)
  
          ungapped_prot = str(prot_seq.seq).replace('-', '')
  
          if len(ungapped_prot) != len(codons):
              table = self.translation_table.forward_table
              prot_str = ' '.join(' ' + p + ' ' for p in ungapped_prot)
              codon_str = ' '.join(codons)
              trans_str = ' '.join(' ' + table.get(codon, 'X') + ' '
                                   for codon in codons)
              raise ValueError("""Length of codon sequence ({0}) does not match \
  length of protein sequence ({1}) for {2}
  Protein:       {3}
  Codons:        {4}
  Trans. Codons: {5}""".format(len(codons), len(ungapped_prot), nucl_seq.id, prot_str,
                              codon_str, trans_str))
  
          try:
              nucl_align = ['---' if p == '-' else next(codon_iter)
                            for p in str(prot_seq.seq)]
          except StopIteration:
              assert False  # Should be checked above
  
          result = SeqRecord(Seq(''.join(nucl_align)), id=nucl_seq.id,
                             description=nucl_seq.description)
  
          # Validate
          self._validate_translation(prot_seq.seq.upper(), result.seq.upper())
  
          return result
docs: Use aligned prot_seq to align nucl_seq