'Create a new HTTP(S)ConnectionPool for a (host, port) tuple'

def create_pool(self, host):

    options = {'timeout': self.timeout, 'strict': True, 'retries': host.get('retries', 2), 'maxsize': host.get('maxsize', 5), 'block': False, 'headers': host.get('headers', {})}
    if ('basic_auth' in host):
        options['headers']['authorization'] = encode_basic_auth(host['basic_auth'])
    if self.tcp_keepalive:
        options['socket_options'] = (HTTPConnection.default_socket_options + [(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)])
    if ('http_port' in host):
        import warnings
        warnings.warn("'http_port'    has    been    deprecated.    Use    'port'.", DeprecationWarning)
        host['port'] = host.pop('http_port')
    addr = host.get('host', '127.0.0.1')
    port = int(host.get('port', 8098))
    secure = host.get('secure', False)
    if (not secure):
        connection_cls = HTTPConnectionPool
    else:
        connection_cls = HTTPSConnectionPool
        verify_ssl = host.get('verify_ssl', False)
        if verify_ssl:
            options.extend({'cert_reqs': host.get('cert_reqs', 'CERT_REQUIRED'), 'ca_certs': host.get('ca_certs', ca_certs())})
    return connection_cls(addr, port, **options)
