if name =country_namereturn code if the country wasn' foundreturn none return none print(get_country_code('andorra')print(get_country_code('united arab emirates')print(get_country_code('afghanistan')we pass get_country_code(the name of the country and store it in the parameter country_name we then loop through the code-name pairs in countries if the name of the country is foundthe country code is returned we add line after the loop to return none if the country name was not found finallywe pass three country names to check that the function works as expectedthe program outputs three two-letter country codesad ae af before using this functionremove the print statements from country_codes py next we import get_country_code(into world_population pyworld_ population py import json from country_codes import get_country_code --snip-print the population for each country for pop_dict in pop_dataif pop_dict['year'=' 'country_name pop_dict['country name'population int(float(pop_dict['value']) code get_country_code(country_nameif codev print(code ""str(population) elseprint('error country_nameafter extracting the country name and populationwe store the country code in code or none if no code is available if code is returnedthe code and country' population are printed if the code is not availablewe display an error message with the name of the country we can' find code for run this programand you'll see some country codes with their populations and some error lineserror arab world error caribbean small states error east asia pacific (all income levels