<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _choose_pool(self, protocol=None):
 """ Selects a connection pool according to the default protocol and the passed one. :param protocol: the protocol to use :type protocol: string :rtype: Pool """

        if not protocol:
            protocol = self.protocol
        if protocol == 'http':
            pool = self._http_pool
        elif protocol == 'tcp' or protocol == 'pbc':
            pool = self._tcp_pool
        else:
            raise ValueError("invalid protocol %s" % protocol)
        if pool is None or self._closed:
            # NB: GH-500, this can happen if client is closed
            raise RuntimeError("Client is closed.")
        return pool