def _ungap(alphabet):
 if (not hasattr(alphabet, 'gap_char')):
  return alphabet
 elif isinstance(alphabet, Gapped):
  return alphabet.alphabet
 elif isinstance(alphabet, HasStopCodon):
  return HasStopCodon(_ungap(alphabet.alphabet), stop_symbol=alphabet.stop_symbol)
 elif isinstance(alphabet, AlphabetEncoder):
  return AlphabetEncoder(_ungap(alphabet.alphabet), letters=alphabet.letters)
 else:
  raise NotImplementedError

def _ungap ( alphabet ) : if ( not hasattr ( alphabet , 'gap_char' ) ) : return alphabet elif isinstance ( alphabet , Gapped ) : return alphabet . alphabet elif isinstance ( alphabet , HasStopCodon ) : return HasStopCodon ( _ungap ( alphabet . alphabet ) , stop_symbol = alphabet . stop_symbol ) elif isinstance ( alphabet , AlphabetEncoder ) : return AlphabetEncoder ( _ungap ( alphabet . alphabet ) , letters = alphabet . letters ) else : raise NotImplementedError
returns the alphabet without any gap encoder .