def check_identity(identity, error_msg):
 email_start = identity.find('<')
 email_end = identity.find('>')
 if ((email_start < 0) or (email_end < 0) or (email_end <= email_start) or (identity.find('<', (email_start + 1)) >= 0) or (identity.find('>', (email_end + 1)) >= 0) or (not identity.endswith('>'))):
  raise ObjectFormatException(error_msg)

def check_identity ( identity , error_msg ) : email_start = identity . find ( '<' ) email_end = identity . find ( '>' ) if ( ( email_start < 0 ) or ( email_end < 0 ) or ( email_end <= email_start ) or ( identity . find ( '<' , ( email_start + 1 ) ) >= 0 ) or ( identity . find ( '>' , ( email_end + 1 ) ) >= 0 ) or ( not identity . endswith ( '>' ) ) ) : raise ObjectFormatException ( error_msg )
check if the specified identity is valid .