if input_email in valid_emails_set:
send_email(input_email, another_param, etc)
Their solution, while isn't wrong, could still be improved. With a somewhat modified 2822 regex with a more strict domain rule. But I would also assume you could just query the db.
I don't see how regular expression come in here. They'd have a list of valid addresses (in a Python dict or in a database or wherever) and they check against them.
Indeed, since this is an internal system validating the uni's own emails it could easily query the uni's MSA for valid addresses.
Although for a set of 80k items and long-running processes (fcgi or wsgi) you could also load the whole thing in memory directly and not bother with a custom `__contains__`.