def get_username(identifier):
pattern = re.compile('<STR_LIT>')<EOL>if pattern.match(identifier):<EOL><INDENT>try:<EOL><INDENT>user = User.objects.get(email=identifier)<EOL><DEDENT>except:<EOL><INDENT>raise Http404<EOL><DEDENT>else:<EOL><INDENT>return user.username<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return identifier<EOL><DEDENT>
Checks if a string is a email adress or not.