def _print_error(self, stream, tagname, error):
        """Print information from a failure or error to the supplied stream."""
        text = escape(str(error[1]))
        stream.write('\n')
        stream.write('    <%s type="%s">%s\n' \
            % (tagname, issubclass(error[0], Exception) and error[0].__name__ or str(error[0]), text))
        tb_stream = StringIO()
        traceback.print_tb(error[2], None, tb_stream)
        stream.write(escape(tb_stream.getvalue()))
        stream.write('    </%s>\n' % tagname)
        stream.write('  ')

# Module level functions since Python 2.3 doesn't grok decorators
dataset/ETHPy150Open binhex/moviegrabber/lib/site-packages/Cheetah/Tests/xmlrunner.py/_TestInfo._print_error/original