def METHOD_NAME(exc_val: EnumeratedError) -> Dict[str, Any]:
    return {
        "type": exc_val.detail.get("class", exc_val.__class__.__name__),
        "code": exc_val.code.value.code,
        "message": exc_val.message.strip(),
        "detail": {k: v for k, v in exc_val.detail.items()},
        "wrapping": [METHOD_NAME(wrapped) for wrapped in exc_val.wrapping],
    }