code: def _save_json(self, filename):
          
          with open(filename, 'w') as file_handle:
              json.dump(self._sensors, file_handle, cls=MySensorsJSONEncoder,
                        indent=4)
              file_handle.flush()
              os.fsync(file_handle.fileno())
docs: Save sensors to json file.