I am using the tempfile Python module to create a temporary file. I need to write to the file, and then I need to change the mode of the file so it is read-only (chmod 400). Is