def exception_str(exc):
    """Call this to get the exception string associated with the given exception
    or tuple of the form (exc, traceback) or (exc_class, exc, traceback).
    """
    if isinstance(exc, tuple) and len(exc) == 3:
        return str(exc[1])

    return str(exc)