'Write out element for comparison, using real file.'

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

    ElementTree = self.etree.ElementTree
    (handle, filename) = tempfile.mkstemp()
    try:
        f = open(filename, 'wb')
        tree = ElementTree(element=element)
        tree.write(f, encoding=encoding)
        f.close()
        f = open(filename, 'rb')
        data = f.read()
        f.close()
    finally:
        os.close(handle)
        os.remove(filename)
    return canonicalize(data)
