docs: def _create_file(self, filename):
          """Ensure a new file is created and opened for writing."""
          file_descriptor = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_EXCL)
          return os.fdopen(file_descriptor, 'w')