input: Write a function to generate an XML document using Python which includes a list of items. The function should take a list of items as input and generate an XML file containing these items as sub-elements under a root element named 'data'. The function should generate the XML document and save it to a file named 'data.xml'.
  assert generate_xml(['Item1', 'Item2', 'Item3'])==True
  assert generate_xml(['ProductA', 'ProductB'])==True
  assert generate_xml([])==True
output: def generate_xml(items):
      from xml.etree.ElementTree import Element, SubElement, tostring
      root = Element('data')
      for item in items:
          SubElement(root, 'item').text = item
      with open('data.xml', 'wb') as f:
          f.write(tostring(root))
      return True