Handling 502s in Genesys Webhook Consumer with Python SDK

Our webhook endpoint is returning 502 errors intermittently, causing Genesys to drop events. We need a reliable way to implement a dead letter queue for failed deliveries. The current retry logic isn’t catching these specific 5xx errors before they timeout. Is there a recommended pattern in the Python SDK for handling these failures without losing the payload?