from textwrap import dedent
import traceback


def format_exception_trace(exception: BaseException) -> str:
    """
    Formats the traceback part of an exception as it would appear when printed by Python's exception handler.

    Args:
        exception: The exception to format

    Returns:
        A string, usually multiline, with the traceback info. There is no newline at the end and no ``'Traceback:'``
        header. The text has a base indent of 0, so as to allow you to add your own.
    """
    return dedent(''.join(traceback.format_list(traceback.extract_tb(exception.__traceback__))).rstrip())