code: def _reconnect_delay(self):
          
          if self.RECONNECT_ON_ERROR and self.RECONNECT_DELAYED:
              if self._reconnect_attempts >= len(self.RECONNECT_DELAYS):
                  return self.RECONNECT_DELAYS[-1]
              else:
                  return self.RECONNECT_DELAYS[self._reconnect_attempts]
          else:
              return 0
docs: Calculate reconnection delay.