#Import os Library
import os
#Open a file
fd = os.open( "file.txt", os.O_RDWR|os.O_CREAT )
#Write a bytestring
str = b"test"
os.write(fd, str)
#Peform force write on file
os.fsync(fd)
#close the file
os.close(fd)