code: def set_umask(mask):
      '''
      Temporarily set the umask and restore once the contextmanager exits
      '''
      if mask is None or salt.utils.platform.is_windows():
          # Don't attempt on Windows, or if no mask was passed
          yield
      else:
          try:
              orig_mask = os.umask(mask)  # pylint: disable=blacklisted-function
              yield
          finally:
              os.umask(orig_maskf set_umask(mask):
      '''
      Temporarily set the umask and restore once the contextmanager exits
      '''
      if mask is None or salt.utils.platform.is_windows():
          # Don't attempt on Windows, or if no mask was passed
          yield
      else:
          try:
              orig_mask = os.umask(mask)  # pylint: disable=blacklisted-function
              yield
          finally:
              os.umask(orig_mask)
docs: Temporarily set the umask and restore once the contextmanager exits