code: def _create_file_racefree(self, file):
          
          write_lock_flags = os.O_CREAT | os.O_EXCL | os.O_WRONLY
          os.open(file, write_lock_flags)
docs: Creates a file, but fails if the file already exists.
          
          This function will thus only succeed if this process actually creates 
          the file; if the file already exists, it will cause an OSError, 
          solving race conditions.
  
          :param str file: File to create.