def write_xml(self, file_path: str, pretty=False, strict=True): """Generates XML compatible with Moodle and saves to a file. Args: file_path (str): filename where the XML will be saved pretty (bool): saves XML pretty printed. strict (bool): saves using strict Moodle format. """ root = et.Element("quiz") self._to_xml_element(root, strict) with et._get_writer(file_path, "utf-8") as write: write("<?xml version='1.0' encoding='utf-8'?>\n") serialize_fxml(write, root, True, pretty)