'Asserts that two XML snippets are semantically the same.
Whitespace in most cases is ignored, and attribute ordering is not
significant. The passed-in arguments must be valid XML.'

def assertXMLEqual(self, xml1, xml2, msg=None):

    try:
        result = compare_xml(xml1, xml2)
    except Exception as e:
        standardMsg = (u'First    or    second    argument    is    not    valid    XML\n%s' % e)
        self.fail(self._formatMessage(msg, standardMsg))
    else:
        if (not result):
            standardMsg = (u'%s    !=    %s' % (safe_repr(xml1, True), safe_repr(xml2, True)))
            self.fail(self._formatMessage(msg, standardMsg))
