def _make_triplets(seq, phase=0):
 pre = seq[:phase]
 np_seq = seq[phase:]
 non_triplets = (len(np_seq) % 3)
 post = ('' if (not non_triplets) else np_seq[((-1) * non_triplets):])
 intacts = [np_seq[(3 * i):(3 * (i + 1))] for i in range((len(np_seq) // 3))]
 return (pre, intacts, post)

def _make_triplets ( seq , phase = 0 ) : pre = seq [ : phase ] np_seq = seq [ phase : ] non_triplets = ( len ( np_seq ) % 3 ) post = ( '' if ( not non_triplets ) else np_seq [ ( ( - 1 ) * non_triplets ) : ] ) intacts = [ np_seq [ ( 3 * i ) : ( 3 * ( i + 1 ) ) ] for i in range ( ( len ( np_seq ) // 3 ) ) ] return ( pre , intacts , post )
selects a valid amino acid sequence given a 3-letter code input .