def METHOD_NAME(exception, exc_cause):
    assert isinstance(exception, Exception)
    assert isinstance(exc_cause, Exception) or exc_cause is None
    exception.__cause__ = exc_cause
    if exc_cause and not hasattr(exc_cause, "__traceback__"):
        # -- NEEDED-FOR: Python2
        # Otherwise, traceback formatting tries to access missing attribute.
        exc_cause.__traceback__ = None