def _check_alignment(num_words, num_mots, alignment):
 assert (type(alignment) is Alignment)
 if (not all(((0 <= pair[0] < num_words) for pair in alignment))):
  raise IndexError(u'Alignment is outside boundary of words')
 if (not all((((pair[1] is None) or (0 <= pair[1] < num_mots)) for pair in alignment))):
  raise IndexError(u'Alignment is outside boundary of mots')

def _check_alignment ( num_words , num_mots , alignment ) : assert ( type ( alignment ) is Alignment ) if ( not all ( ( ( 0 <= pair [ 0 ] < num_words ) for pair in alignment ) ) ) : raise IndexError ( u'Alignment is outside boundary of words' ) if ( not all ( ( ( ( pair [ 1 ] is None ) or ( 0 <= pair [ 1 ] < num_mots ) ) for pair in alignment ) ) ) : raise IndexError ( u'Alignment is outside boundary of mots' )
check whether the alignments are legal .