def save(self):
if self.filename is None:<EOL><INDENT>raise StoreException("<STR_LIT>")<EOL><DEDENT>filename = "<STR_LIT>".format(<EOL>filename=self.filename,<EOL>date=datetime.datetime.utcnow().strftime('<STR_LIT>')<EOL>)<EOL>mode = stat.S_IRUSR | stat.S_IWUSR  <EOL>fd = os.open(filename, os.O_WRONLY | os.O_CREAT, mode)<EOL>fout = os.fdopen(fd, "<STR_LIT:w>")<EOL>fout.write(json.dumps(self.export()))<EOL>fout.close()<EOL>if os.path.isfile(self.filename):<EOL><INDENT>os.remove(self.filename)<EOL><DEDENT>os.rename(filename, self.filename)<EOL>
Saves dictionary to disk in JSON format.