def flush(self, fsync=False):
if self._handle is not None:<EOL><INDENT>self._handle.flush()<EOL>if fsync:<EOL><INDENT>try:<EOL><INDENT>os.fsync(self._handle.fileno())<EOL><DEDENT>except OSError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>
Force all buffered modifications to be written to disk.

Parameters
----------
fsync : bool (default False)
  call ``os.fsync()`` on the file handle to force writing to disk.

Notes
-----
Without ``fsync=True``, flushing may not guarantee that the OS writes
to disk. With fsync, the operation will block until the OS claims the
file has been written; however, other caching layers may still
interfere.