docs: def flipwritable(fn, mode=None):
      """
      Flip the writability of a file and return the old mode. Returns None
      if the file is already writable.
      """
      if os.access(fn, os.W_OK):
          return None
      old_mode = os.stat(fn).st_mode
      os.chmod(fn, stat.S_IWRITE | old_mode)
      return old_mode