def METHOD_NAME(exception: Exception, exceptions: list[Exception]) -> None:
    if isinstance(exception, AggregateException):
        for ex in exception.exceptions:
            if ex:
                AggregateException.METHOD_NAME(ex, exceptions)
    else:
        exceptions.append(exception)