def __init__(self,
                 protocol='pbc',
                 transport_options={},
                 nodes=None,
                 credentials=None,
                 multiget_pool_size=None,
                 multiput_pool_size=None,
                 **kwargs):
        """
        Construct a new ``RiakClient`` object.

        :param protocol: the preferred protocol, defaults to 'pbc'
        :type protocol: string
        :param nodes: a list of node configurations,
           where each configuration is a dict containing the keys
           'host', 'http_port', and 'pb_port'
        :type nodes: list
        :param transport_options: Optional key-value args to pass to
                                  the transport constructor
        :type transport_options: dict
        :param credentials: optional object of security info
        :type credentials: :class:`~riak.security.SecurityCreds` or dict
        :param multiget_pool_size: the number of threads to use in
           :meth:`multiget` operations. Defaults to a factor of the number of
           CPUs in the system
        :type multiget_pool_size: int
        :param multiput_pool_size: the number of threads to use in
           :meth:`multiput` operations. Defaults to a factor of the number of
           CPUs in the system
        :type multiput_pool_size: int
        """
        kwargs = kwargs.copy()

        if nodes is None:
            self.nodes = [
                self._create_node(kwargs),
            ]
        else:
            self.nodes = [self._create_node(n) for n in nodes]

        self._multiget_pool_size = multiget_pool_size
        self._multiput_pool_size = multiput_pool_size
        self.protocol = protocol or 'pbc'
        self._resolver = None
        self._credentials = self._create_credentials(credentials)
        self._http_pool = HttpPool(self, **transport_options)
        self._tcp_pool = TcpPool(self, **transport_options)
        self._closed = False

        if PY2:
            self._encoders = {
                'application/json': default_encoder,
                'text/json': default_encoder,
                'text/plain': str
            }
            self._decoders = {
                'application/json': json.loads,
                'text/json': json.loads,
                'text/plain': str
            }
        else:
            self._encoders = {
                'application/json': binary_json_encoder,
                'text/json': binary_json_encoder,
                'text/plain': str_to_bytes,
                'binary/octet-stream': binary_encoder_decoder
            }
            self._decoders = {
                'application/json': binary_json_decoder,
                'text/json': binary_json_decoder,
                'text/plain': bytes_to_str,
                'binary/octet-stream': binary_encoder_decoder
            }
        self._buckets = WeakValueDictionary()
        self._bucket_types = WeakValueDictionary()
        self._tables = WeakValueDictionary()