429 Too Many Requests on /api/v2/users bulk update with exponential backoff

We are running a Terraform refresh script that iterates through a list of users to update their routing profiles via the /api/v2/users/{id} endpoint. The Python script uses the requests library and implements a basic linear retry loop, but we are still hitting 429 Too Many Requests errors after about 50 updates. The code increments the wait time by one second each attempt, yet the API continues to throttle the requests aggressively, causing the script to hang indefinitely on the retry limit.

The current retry logic looks like this: time.sleep(1 + attempt). I suspect the linear backoff is too slow or perhaps not aligned with the rate limit window. We need a proper exponential backoff strategy that respects the Retry-After header if present. Can someone share a solid Python snippet for handling this specific rate limit scenario without blocking the entire pipeline?