def write_config()

in src/smspark/config.py [0:0]


    def write_config(self) -> str:
        """Write or update configuration file."""
        try:
            self.path.parent.mkdir(parents=True, exist_ok=True)
        except FileExistsError:
            pass
        if self._data.serializer == xml_serializer:
            contents = ""
            if self.path.exists():
                with open(self.path, "r") as f:
                    contents += f.read()
                    # inserts properties before the closing </configuration> tag.
                    contents = contents.replace("</configuration>", f"\n{self.serialized}</configuration>")
            else:
                contents += """<?xml version="1.0"?>\n"""
                contents += """<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>\n"""
                contents += "<configuration>\n"
                contents += f"{self.serialized}\n"
                contents += "</configuration>"
            with open(self.path, "w") as f:
                f.write(contents)
        else:
            with open(self.path, "a") as f:
                f.write(self.serialized)
        with open(self.path, "r") as f:
            conf_string = f.read()
            return conf_string