code: def temporary_locale(temp_locale=None):
      '''Enable code to run in a context with a temporary locale
  
      Resets the locale back when exiting context.
      Can set a temporary locale if provided
      '''
      orig_locale = locale.setlocale(locale.LC_ALL)
      if temp_locale is not None:
          locale.setlocale(locale.LC_ALL, temp_locale)
      yield
      locale.setlocale(locale.LC_ALL, orig_localef temporary_locale(temp_locale=None):
      '''Enable code to run in a context with a temporary locale
  
      Resets the locale back when exiting context.
      Can set a temporary locale if provided
      '''
      orig_locale = locale.setlocale(locale.LC_ALL)
      if temp_locale is not None:
          locale.setlocale(locale.LC_ALL, temp_locale)
      yield
      locale.setlocale(locale.LC_ALL, orig_locale)
docs: Enable code to run in a context with a temporary locale
  
      Resets the locale back when exiting context.
      Can set a temporary locale if provided