def match_country_name_to_its_code(country_name, city='<STR_LIT>'):
if country_name:<EOL><INDENT>country_name = country_name.upper().replace('<STR_LIT:.>', '<STR_LIT>').strip()<EOL>if country_to_iso_code.get(country_name):<EOL><INDENT>return country_to_iso_code.get(country_name)<EOL><DEDENT>elif country_name == '<STR_LIT>':<EOL><INDENT>if city.upper() in south_korean_cities:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for c_code, spellings in countries_alternative_spellings.items():<EOL><INDENT>for spelling in spellings:<EOL><INDENT>if country_name == spelling:<EOL><INDENT>return c_code<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>return None<EOL>
Try to match country name with its code.

    Name of the city helps when country_name is "Korea".