input: Write a function to construct an XML document using Python which contains the mentioned items as sub-elements under a root element named 'data'. The function should take a list of items as input and generate an XML file named 'data.xml'. If the input list is empty, it should still create an XML file with an empty root element.
  
  def create_xml_document(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
  
      # write the XML Tree
      tree = ET.ElementTree(data)
      tree.write('data.xml')
  
  assert create_xml_document(['Item1'])==None 
  assert create_xml_document(['Item2', 'Item3'])==None 
  assert create_xml_document([])==None 
  assert create_xml_document(['Item1', 'Item4', 'Item5'])==None
output: def create_xml_document(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)
      tree.write('data.xml')