def _check_servers(self):
new_servers = []<EOL>def check_format(server):<EOL><INDENT>if server.scheme not in ["<STR_LIT>", "<STR_LIT:http>", "<STR_LIT>"]:<EOL><INDENT>raise RuntimeError("<STR_LIT>" % _type)<EOL><DEDENT>if server.scheme == "<STR_LIT>":<EOL><INDENT>if not thrift_connect:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>if server.port is None:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT><DEDENT>new_servers.append(server)<EOL><DEDENT>for server in self.servers:<EOL><INDENT>if isinstance(server, (tuple, list)):<EOL><INDENT>if len(list(server)) != <NUM_LIT:3>:<EOL><INDENT>raise RuntimeError("<STR_LIT>" % repr(server))<EOL><DEDENT>_type, host, port = server<EOL>server = urlparse('<STR_LIT>' % (_type, host, port))<EOL>check_format(server)<EOL><DEDENT>elif isinstance(server, six.string_types):<EOL><INDENT>if server.startswith(("<STR_LIT>", "<STR_LIT>", "<STR_LIT>")):<EOL><INDENT>server = urlparse(server)<EOL>check_format(server)<EOL>continue<EOL><DEDENT>else:<EOL><INDENT>tokens = [t for t in server.split("<STR_LIT::>") if t.strip()]<EOL>if len(tokens) == <NUM_LIT:2>:<EOL><INDENT>host = tokens[<NUM_LIT:0>]<EOL>try:<EOL><INDENT>port = int(tokens[<NUM_LIT:1>])<EOL><DEDENT>except ValueError:<EOL><INDENT>raise RuntimeError("<STR_LIT>" % tokens[<NUM_LIT:1>])<EOL><DEDENT>if <NUM_LIT> <= port <= <NUM_LIT>:<EOL><INDENT>_type = "<STR_LIT:http>"<EOL><DEDENT>elif <NUM_LIT> <= port <= <NUM_LIT>:<EOL><INDENT>_type = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>raise RuntimeError("<STR_LIT>" % port)<EOL><DEDENT>server = urlparse('<STR_LIT>' % (_type, host, port))<EOL>check_format(server)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>self.servers = new_servers<EOL>
Check the servers variable and convert in a valid tuple form