input: Write a function that constructs an XML document using Python based on a list of items provided. The function should create an XML tree with a root element named 'data', where each item from the input list should be represented as a sub-element named 'item'. Finally, the function should write the XML tree to a file named 'data.xml'.
  
  import xml.etree.ElementTree as ET
  
  def create_xml(items):
      # 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(['Item1', 'Item2', 'Item3']) is None
output: import xml.etree.ElementTree as ET
  
  def create_xml(items):
      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')