code: def calculate_retry_delay(attempt, max_delay=300):
      
      delay = int(random.uniform(2, 4) ** attempt)
      if delay > max_delay:
          # After reaching the max delay, stop using expontential growth
          # and keep the delay nearby the max.
          delay = int(random.uniform(max_delay - 20, max_delay + 20))
      return delay
docs: Calculates an exponential backoff for retry attempts with a small
      amount of jitter.