input: Write a python function to convert a string of HTML text into valid XML.
  assert html_to_xml('<div><p>Hello World!</p></div>') == '<?xml version="1.0" ?>\n<xmlroot>\n  <div/>\n  <p/>\n</xmlroot>\n'
  assert html_to_xml('<body><h1>Title</h1><p>Paragraph</p></body>') == '<?xml version="1.0" ?>\n<xmlroot>\n  <body/>\n  <h1/>\n  <p/>\n</xmlroot>\n'
  assert html_to_xml('<html><head><title>Test</title></head><body><p>Content</p></body></html>') == '<?xml version="1.0" ?>\n<xmlroot>\n  <html/>\n  <head/>\n  <title/>\n  <body/>\n  <p/>\n</xmlroot>\n'
output: def html_to_xml(html):
      import xml.etree.ElementTree as ET
  
      # Create a root element for XML
      xml_root = ET.Element("xmlroot")
  
      # Parse the HTML content
      from html.parser import HTMLParser
  
      class MyHTMLParser(HTMLParser):
          def __init__(self):
              super().__init__()
              self.stack = []
  
          def handle_starttag(self, tag, attrs):
              # Append new XML element to the top of the stack
              elem = ET.Element(tag)
              if self.stack:
                  self.stack[-1].append(elem)
              else:
                  xml_root.append(elem)
              self.stack.append(elem)
  
          def handle_endtag(self, tag):
              self.stack.pop()
  
          def handle_data(self, data):
              pass
  
      parser = MyHTMLParser()
      parser.feed(html)
  
      # Convert XML tree to string
      xml_str = ET.tostring(xml_root, encoding='unicode', method='xml')
      
      # Add XML declaration
      xml_declaration = '<?xml version="1.0" ?>\n'
      
      # Convert the final XML string
      from xml.dom.minidom import parseString
      dom = parseString(xml_str)
      pretty_xml_as_string = dom.toprettyxml()
      
      # Return the final XML string
      return xml_declaration + pretty_xml_as_string.replace('<?xml version="1.0" ?>\n', '')