pub fn format_exception(e: &PyErr) -> String
Formats a Python exception, including its traceback and chained exceptions.
Falls back to the exception type and message if traceback formatting fails.