input: Write a function to create an XML document in Python that contains the data of a given list, with each item in the list represented as a sub-element under a root element named 'data'. If the list is empty, create an empty XML document with just the root element. 
  
  def construct_xml(items):
      import xml.etree.ElementTree as ET
  
      # creating the root element
      data = ET.Element('data')
  
      # loop over items
      for item in items:
          # creating sub elements
          item_element = ET.SubElement(data, 'item')
  
          # assign the value for the sub elements
          item_element.text = item
  
      # create an ElementTree object
      tree = ET.ElementTree(data)
      
      return tree
  
  assert construct_xml(['Item1', 'Item2', 'Item3']).getroot().tag=='data'
  assert construct_xml(['Item1', 'Item2', 'Item3']).getroot()[0].text=='Item1'
  assert construct_xml([]).getroot().tag=='data'
output: def construct_xml(items):
      import xml.etree.ElementTree as ET
      data = ET.Element('data')
      for item in items:
          item_element = ET.SubElement(data, 'item')
          item_element.text = item
      tree = ET.ElementTree(data)
      return tree