def get_pool_for_host(self, host_id):
        if isinstance(host_id, HostInfo):
            host_info = host_id
            host_id = host_info.host_id
        else:
            host_info = self.hosts.get(host_id)
            if host_info is None:
                raise LookupError('Host %r does not exist' % (host_id,))

        rv = self._pools.get(host_id)
        if rv is not None:
            return rv
        with self._lock:
            rv = self._pools.get(host_id)
            if rv is None:
                opts = dict(self.pool_options or ())
                opts['db'] = host_info.db
                opts['password'] = host_info.password
                if host_info.unix_socket_path is not None:
                    opts['path'] = host_info.unix_socket_path
                    opts['connection_class'] = UnixDomainSocketConnection
                    if host_info.ssl:
                        raise TypeError('SSL is not supported for unix '
                                        'domain sockets.')
                else:
                    opts['host'] = host_info.host
                    opts['port'] = host_info.port
                    if host_info.ssl:
                        if SSLConnection is None:
                            raise TypeError('This version of py-redis does '
                                            'not support SSL connections.')
                        opts['connection_class'] = SSLConnection
                        opts.update(('ssl_' + k, v) for k, v in
                                    (host_info.ssl_options or {}).iteritems())
                rv = self.pool_cls(**opts)
                self._pools[host_id] = rv
            return rv
Check target matches environment setting (for sanity)
dataset/ETHPy150Open getsentry/rb/rb/cluster.py/Cluster.get_pool_for_host--crossover with--dataset/ETHPy150Open chapmanb/cloudbiolinux/cloudbio/distribution.py/_validate_target_distribution