'Writes element out and checks whether it is expected.
Does this two ways; once using BytesIO, once using a real file.'

def assertXML(self, expected, element, encoding='us-ascii'):

    if isinstance(expected, unicode):
        expected = expected.encode(encoding)
    self.assertEqual(expected, self._writeElement(element, encoding))
    self.assertEqual(expected, self._writeElementFile(element, encoding))
