code: def open(self, filepath, mode='w+b'):
          
          #Check if the filepath can be accessed and is writable before creating
          #the tempfile
          if not _isFileAccessible(filepath):
              raise IOError('File %s is not writable' % (filepath,))
  
          if filepath in self._files:
              with open(self._files[filepath], mode=mode) as tmpf:
                  yield tmpf
          else:
              tempfilepath = None
              with tempfile.NamedTemporaryFile(delete=False, mode=mode) as tmpf:
                  tempfilepath = tmpf.name
                  yield tmpf
              self._files[filepath] = tempfilepath
docs: Opens a file - will actually return a temporary file but replace the
          original file when the context is closed.