code: def norm_locale (loc):
      
      loc = locale.normalize(loc)
      # split up the locale into its base components
      pos = loc.find('@')
      if pos >= 0:
          loc = loc[:pos]
      pos = loc.find('.')
      if pos >= 0:
          loc = loc[:pos]
      pos = loc.find('_')
      if pos >= 0:
          loc = loc[:pos]
      return loc
docs: Normalize a locale.