'Converts a sys.exc_info()-style tuple of values into a string.'

def _exc_info_to_string(self, err, test):

    (exctype, value, tb) = err
    while (tb and self._is_relevant_tb_level(tb)):
        tb = tb.tb_next
    if (exctype is test.failureException):
        length = self._count_relevant_tb_levels(tb)
        return ''.join(traceback.format_exception(exctype, value, tb, length))
    return ''.join(traceback.format_exception(exctype, value, tb))
