code: def _get_next_available_channel_id(self):
          
          for index in compatibility.RANGE(self._last_channel_id or 1,
                                           self.max_allowed_channels + 1):
              if index in self._channels:
                  continue
              self._last_channel_id = index
              return index
  
          if self._last_channel_id:
              self._last_channel_id = None
              return self._get_next_available_channel_id()
  
          raise AMQPConnectionError(
              'reached the maximum number of channels %d' %
              self.max_allowed_channels)
docs: Returns the next available available channel id.
          :raises AMQPConnectionError: Raises if there is no available channel.
          :rtype: int