code: def xml_open(filename, expected_root=None):
      
  
      # Is the file a zip (.twbx or .tdsx)
      if zipfile.is_zipfile(filename):
          tree = get_xml_from_archive(filename)
      else:
          tree = ET.parse(filename)
  
      # Is the file a supported version
      tree_root = tree.getroot()
      file_version = Version(tree_root.attrib.get('version', '0.0'))
  
      if file_version < MIN_SUPPORTED_VERSION:
          raise TableauVersionNotSupportedException(file_version)
  
      # Does the root tag match the object type (workbook or data source)
      if expected_root and (expected_root != tree_root.tag):
          raise TableauInvalidFileException(
              "'{}'' is not a valid '{}' file".format(filename, expected_root))
  
      return tree
docs: Opens the provided 'filename'. Handles detecting if the file is an archive,
      detecting the document version, and validating the root tag.