code: def _add_domains_xml(self, document):
          
          for domain, attrs in self.domains.items():
              domain_element = document.createElement('allow-access-from')
              domain_element.setAttribute('domain', domain)
              if attrs['to_ports'] is not None:
                  domain_element.setAttribute(
                      'to-ports',
                      ','.join(attrs['to_ports'])
                  )
              if not attrs['secure']:
                  domain_element.setAttribute('secure', 'false')
              document.documentElement.appendChild(domain_element)
docs: Generates the XML elements for allowed domains.