code: def _get_channel(self):
          '''
          Fetch a channel from the pool. Will return a new one if necessary. If
          a channel in the free pool is closed, will remove it. Will return None
          if we hit the cap. Will clean up any channels that were published to
          but closed due to error.
          '''
          while len(self._free_channels):
              rval = self._free_channels.pop()
              if not rval.closed:
                  return rval
              # don't adjust _channels value because the callback will do that
              # and we don't want to double count it.
  
          if not self._size or self._channels < self._size:
              rval = self._connection.channel()
              self._channels += 1
              rval.add_close_listener(self._channel_closed_cb)
              return rvaf _get_channel(self):
          '''
          Fetch a channel from the pool. Will return a new one if necessary. If
          a channel in the free pool is closed, will remove it. Will return None
          if we hit the cap. Will clean up any channels that were published to
          but closed due to error.
          '''
          while len(self._free_channels):
              rval = self._free_channels.pop()
              if not rval.closed:
                  return rval
              # don't adjust _channels value because the callback will do that
              # and we don't want to double count it.
  
          if not self._size or self._channels < self._size:
              rval = self._connection.channel()
              self._channels += 1
              rval.add_close_listener(self._channel_closed_cb)
              return rval
docs: Fetch a channel from the pool. Will return a new one if necessary. If
          a channel in the free pool is closed, will remove it. Will return None
          if we hit the cap. Will clean up any channels that were published to
          but closed due to error.