def code_mapping(level, msg, default=<NUM_LIT>):
try:<EOL><INDENT>return code_mappings_by_level[level][msg]<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT>if msg.count('<STR_LIT:">') == <NUM_LIT:2> and '<STR_LIT>' in msg and msg.endswith('<STR_LIT>'):<EOL><INDENT>txt = msg[: msg.index('<STR_LIT>')]<EOL>return code_mappings_by_level[level].get(txt, default)<EOL><DEDENT>return default<EOL>
Return an error code between 0 and 99.