I use the following code, which I got from this question, to get country codes from their russian names.
def get_country_code(russian_name):
gettext.translation('iso3166', pycountry.LOCALES_DIR, languages=['RU']).install()
country_code = ''.join([country.alpha_2 for country in pycountry.countries if _(country.name) == russian_name])
return country_code
But as I try to use this function in my jupyter-notebook, it gives me the following error:
TypeError: 'str' object is not callable
Is seems like this is because in jupyter as well as in interactive mode _ means the result of the previous calculation, but gettext define it as its function.
How can I execute this code in Jupyter?