code: def _save_file(self, data):
          
  
          if platform.system() == 'Windows':
              with open(self.file, "w") as outfile:
                  json.dump(data, outfile)
          else:
              newpath = self.file + '.new'
  
              with open(newpath, "w") as outfile:
                  json.dump(data, outfile)
  
              os.rename(
                  os.path.realpath(newpath),
                  os.path.realpath(self.file)
              )
docs: Attempt to atomically save file by saving and then moving into position
  
          The goal is to make it difficult for a crash to corrupt our data file since
          the move operation can be made atomic if needed on mission critical filesystems.