code: def set_locale(lang):
      
      # get the default locale
      lc, encoding = locale.getdefaultlocale()
      try:
          if '.' in lang:
              locale.setlocale(locale.LC_ALL, lang)
          else:
              locale.setlocale(locale.LC_ALL, (lang, encoding))
      except locale.Error:
          return False
      return True
docs: Set the 'locale' used by a program.
  
      This affects the entire application, changing the way dates,
      currencies and numbers are represented. It should not be called
      from a library routine that may be used in another program.
  
      The ``lang`` parameter can be any string that is recognised by
      ``locale.setlocale()``, for example ``en``, ``en_GB`` or ``en_GB.UTF-8``.
  
      :param lang: language code.
      :type lang: string
      :return: success status.
      :rtype: bool