def _get_next_server(self):
current_try = <NUM_LIT:0><EOL>max_tries = len(self._servers)<EOL>while current_try < max_tries:<EOL><INDENT>server_index = self._raise_server_index()<EOL>server = self._servers[server_index]<EOL>down_until = server['<STR_LIT>']<EOL>self._logger.debug('<STR_LIT>' + str(current_try + <NUM_LIT:1>) + '<STR_LIT:/>' + str(max_tries) + '<STR_LIT>' + server['<STR_LIT:url>'])<EOL>if down_until == <NUM_LIT:0>:<EOL><INDENT>self._logger.debug('<STR_LIT>' + server['<STR_LIT:url>'])<EOL>return server<EOL><DEDENT>if down_until < time.time():<EOL><INDENT>if self._is_reachable(server):<EOL><INDENT>server['<STR_LIT>'] = <NUM_LIT:0><EOL>self._logger.debug('<STR_LIT>' + server['<STR_LIT:url>'])<EOL>return server<EOL><DEDENT>else:<EOL><INDENT>self._logger.debug('<STR_LIT>' + server['<STR_LIT:url>'])<EOL>server['<STR_LIT>'] = time.time() + <NUM_LIT:5><EOL><DEDENT><DEDENT>current_try += <NUM_LIT:1><EOL><DEDENT>raise TransportException('<STR_LIT>')<EOL>
Returns a valid redis server or raises a TransportException