def METHOD_NAME(exception):
    # The `interesting_origin` is how Hypothesis distinguishes between multiple
    # failures, for reporting and also to replay from the example database (even
    # if report_multiple_bugs=False).  We traditionally use the exception type and
    # location, but have extracted this logic in order to see through `except ...:`
    # blocks and understand the __cause__ (`raise x from y`) or __context__ that
    # first raised an exception as well as PEP-654 exception groups.
    tb = get_trimmed_traceback(exception)
    if tb is None:
        filename, lineno = None, None
    else:
        filename, lineno, *_ = traceback.extract_tb(tb)[-1]
    return (
        type(exception),
        filename,
        lineno,
        # Note that if __cause__ is set it is always equal to __context__, explicitly
        # to support introspection when debugging, so we can use that unconditionally.
        METHOD_NAME(exception.__context__) if exception.__context__ else (),
        # We distinguish exception groups by the inner exceptions, as for __context__
        tuple(
            map(METHOD_NAME, exception.exceptions)
            if isinstance(exception, BaseExceptionGroup)
            else []
        ),
    )