'Check the servers variable and convert in a valid tuple form'

def _check_servers(self):

    new_servers = []
    def check_format(server):
        if (server.scheme not in ['thrift', 'http', 'https']):
            raise RuntimeError(('Unable    to    recognize    protocol:    "%s"' % _type))
        if (server.scheme == 'thrift'):
            if (not thrift_connect):
                raise RuntimeError('If    you    want    to    use    thrift,    please    install    thrift.    "pip    install    thrift"')
            if (server.port is None):
                raise RuntimeError('If    you    want    to    use    thrift,    please    provide    a    port    number')
        new_servers.append(server)
    for server in self.servers:
        if isinstance(server, (tuple, list)):
            if (len(list(server)) != 3):
                raise RuntimeError(('Invalid    server    definition:    "%s"' % repr(server)))
            (_type, host, port) = server
            server = urlparse(('%s://%s:%s' % (_type, host, port)))
            check_format(server)
        elif isinstance(server, six.string_types):
            if server.startswith(('thrift:', 'http:', 'https:')):
                server = urlparse(server)
                check_format(server)
                continue
            else:
                tokens = [t for t in server.split(':') if t.strip()]
                if (len(tokens) == 2):
                    host = tokens[0]
                    try:
                        port = int(tokens[1])
                    except ValueError:
                        raise RuntimeError(('Invalid    port:    "%s"' % tokens[1]))
                    if (9200 <= port <= 9299):
                        _type = 'http'
                    elif (9500 <= port <= 9599):
                        _type = 'thrift'
                    else:
                        raise RuntimeError(('Unable    to    recognize    port-type:    "%s"' % port))
                    server = urlparse(('%s://%s:%s' % (_type, host, port)))
                    check_format(server)
    self.servers = new_servers
