code: def _get_next_server(self):
          
  
          current_try = 0
          max_tries = len(self._servers)
  
          while current_try < max_tries:
  
              server_index = self._raise_server_index()
              server = self._servers[server_index]
              down_until = server['down_until']
  
              self._logger.debug('Checking server ' + str(current_try + 1) + '/' + str(max_tries) + ': ' + server['url'])
  
              if down_until == 0:
                  self._logger.debug('Elected server: ' + server['url'])
                  return server
  
              if down_until < time.time():
                  if self._is_reachable(server):
                      server['down_until'] = 0
                      self._logger.debug('Elected server: ' + server['url'])
  
                      return server
                  else:
                      self._logger.debug('Server still unavailable: ' + server['url'])
                      server['down_until'] = time.time() + 5
  
              current_try += 1
  
          raise TransportException('Cannot reach any redis server')
docs: Returns a valid redis server or raises a TransportException