def check_allowed_letters(seq, allowed_letters_as_set):
<EOL>seq_set = set(seq)<EOL>not_allowed_letters_in_seq = [x for x in seq_set if str(x).upper() not in allowed_letters_as_set]<EOL>if len(not_allowed_letters_in_seq) > <NUM_LIT:0>:<EOL><INDENT>raise forms.ValidationError(<EOL>"<STR_LIT>" + "<STR_LIT:U+002CU+0020>".join(not_allowed_letters_in_seq))<EOL><DEDENT>
Validate sequence: Rise an error if sequence contains undesirable letters.