def _assert_proper_exception_context(exception):
    'assert that any exception we\'re catching does not have a __context__\n    without a __cause__, and that __suppress_context__ is never set.\n\n    Python 3 will report nested as exceptions as "during the handling of\n    error X, error Y occurred". That\'s not what we want to do.  we want\n    these exceptions in a cause chain.\n\n    '
    if (not util.py3k):
        return
    if ((exception.__context__ is not exception.__cause__) and (not exception.__suppress_context__)):
        assert False, ('Exception %r was correctly raised but did not set a cause, within context %r as its cause.' % (exception, exception.__context__))
assert that any exception we're catching does not have a __context__
without a __cause__, and that __suppress_context__ is never set.

Python 3 will report nested as exceptions as "during the handling of
error X, error Y occurred". That's not what we want to do.  we want
these exceptions in a cause chain.
def _assert_proper_exception_context(exception):
    'assert that any exception we\'re catching does not have a __context__\n    without a __cause__, and that __suppress_context__ is never set.\n\n    Python 3 will report nested as exceptions as "during the handling of\n    error X, error Y occurred". That\'s not what we want to do.  we want\n    these exceptions in a cause chain.\n\n    '
    if (not util.py3k):
        return
    if ((exception.__context__ is not exception.__cause__) and (not exception.__suppress_context__)):
        assert False, ('Exception %r was correctly raised but did not set a cause, within context %r as its cause.' % (exception, exception.__context__))