Create file if not exists, throw exception in other case
def write_content_to_file(content, file_path):
output_file = os.fdopen(os.open(file_path, os.O_CREAT | os.O_WRONLY | os.O_EXCL), "w")
output_file.write(content)
output_file.close()