def _force_alphabet(alignment_iterator, alphabet):
 given_base_class = _get_base_alphabet(alphabet).__class__
 for align in alignment_iterator:
  if (not isinstance(_get_base_alphabet(align._alphabet), given_base_class)):
   raise ValueError(('Specified alphabet %s clashes with that determined from the file, %s' % (repr(alphabet), repr(align._alphabet))))
  for record in align:
   if (not isinstance(_get_base_alphabet(record.seq.alphabet), given_base_class)):
    raise ValueError(('Specified alphabet %s clashes with that determined from the file, %s' % (repr(alphabet), repr(record.seq.alphabet))))
   record.seq.alphabet = alphabet
  align._alphabet = alphabet
  (yield align)

def _force_alphabet ( alignment_iterator , alphabet ) : given_base_class = _get_base_alphabet ( alphabet ) . __class__ for align in alignment_iterator : if ( not isinstance ( _get_base_alphabet ( align . _alphabet ) , given_base_class ) ) : raise ValueError ( ( 'Specified alphabet %s clashes with that determined from the file, %s' % ( repr ( alphabet ) , repr ( align . _alphabet ) ) ) ) for record in align : if ( not isinstance ( _get_base_alphabet ( record . seq . alphabet ) , given_base_class ) ) : raise ValueError ( ( 'Specified alphabet %s clashes with that determined from the file, %s' % ( repr ( alphabet ) , repr ( record . seq . alphabet ) ) ) ) record . seq . alphabet = alphabet align . _alphabet = alphabet ( yield align )
iterate over records .