<s> from geonamescache import GeonamesCache <EOL> from . import mappings <EOL> def country ( from_key = '<STR_LIT:name>' , to_key = '<STR_LIT>' ) : <EOL> gc = GeonamesCache ( ) <EOL> dataset = gc . get_dataset_by_key ( gc . get_countries ( ) , from_key ) <EOL> def mapper ( key ) : <EOL> if '<STR_LIT:name>' == from_key and key in mappings . country_names : <EOL> key = mappings . country_names [ key ] <EOL> item = dataset . get ( key ) <EOL> if item : <EOL> return item [ to_key ] <EOL> return mapper </s>
