import traceback


def format_exception(e):
    """
    Format the traceback of the exception ``e`` in a string.
    """
    elements = traceback.format_exception(type(e), e, e.__traceback__)
    return ''.join(elements)