code: def by_name(self, country, language="en"):
          
          with override(language):
              for code, name in self:
                  if name.lower() == country.lower():
                      return code
                  if code in self.OLD_NAMES:
                      for old_name in self.OLD_NAMES[code]:
                          if old_name.lower() == country.lower():
                              return code
          return ""
docs: Fetch a country's ISO3166-1 two letter country code from its name.
  
          An optional language parameter is also available.
          Warning: This depends on the quality of the available translations.
  
          If no match is found, returns an empty string.
  
          ..warning:: Be cautious about relying on this returning a country code
              (especially with any hard-coded string) since the ISO names of
              countries may change over time.