input: Write a function to create an XML document using Python which contains the given list of items. The root element of the XML should be 'data', and each item should be represented as a sub-element 'item'. The function should take a list of items as input and write the XML document to a file named 'data.xml'.
  import xml.etree.ElementTree as ET
  
  def create_xml(items):
      # creating the root element
      data = ET.Element('data')
      
      # creating sub elements for each item
      for item in items:
          item_element = ET.SubElement(data, 'item')
          item_element.text = item
      
      # write the XML Tree to a file
      tree = ET.ElementTree(data)
      tree.write('data.xml')
  
  # Test Cases
  create_xml(['Item1', 'Item2', 'Item3'])
  assert create_xml(['Item1', 'Item2', 'Item3']) == True
  assert create_xml(['Item4', 'Item5']) == True
  assert create_xml([]) == True
output: 
  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')
  