code: def write_xml(self, xmlfile, config=None):
          
  
          root = ElementTree.Element('source_library')
          root.set('title', 'source_library')
  
          for s in self._srcs:
              s.write_xml(root)
  
          if config is not None:
              srcs = self.create_diffuse_srcs(config)
              diffuse_srcs = {s.name: s for s in srcs}
              for s in self._diffuse_srcs:
                  src = copy.deepcopy(diffuse_srcs.get(s.name, s))
                  src.update_spectral_pars(s.spectral_pars)
                  src.write_xml(root)
          else:
              for s in self._diffuse_srcs:
                  s.write_xml(root)
  
          output_file = open(xmlfile, 'w')
          output_file.write(utils.prettify_xml(root))
docs: Save the ROI model as an XML file.