See this line: https://github.com/matrix-org/matrix-python-sdk/blob/master/matrix_client/client.py#L375 which sets the value for bad_sync_timeout to 5000 seconds (probably intended to be milliseconds?), and this line: https://github.com/matrix-org/matrix-python-sdk/blob/master/matrix_client/client.py#L386 which calls time.sleep with that value. Note that time.sleep expects seconds, not millis.
This means that if _sync fails with an HTTP 500, the client will always wait self.bad_sync_timeout_max seconds (currently 1 hour) before retrying.
It looks like there's supposed to be some exponential backoff logic between retries, but because the initial timeout is set so high it always selects the ceiling of one hour.