valid_alphabets = [str(alphabet) for alphabet in alphabets if validate(
    first_record.seq, alphabet)]
print('Valid alpahabet(s) for fasta file: {}'.format(', '.join(valid_alphabets)
    ))
Estimate Alphabet in Biopython from fasta file