<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def on_channel_closed(self, channel, reply_code, reply_text):
 """Invoked by pika when RabbitMQ unexpectedly closes the channel. Channels are usually closed if you attempt to do something that violates the protocol, such as re-declare an exchange or queue with different parameters. In this case, we just want to log the error and create a new channel after setting the state back to connecting. :param pika.channel.Channel channel: The closed channel :param int reply_code: The numeric reason the channel was closed :param str reply_text: The text reason the channel was closed """

        for future in self.messages.values():
            future.set_exception(AMQPException(reply_code, reply_text))
        self.messages = {}
        if self.closing:
            LOGGER.debug('Channel %s was intentionally closed (%s) %s',
                         channel, reply_code, reply_text)
        else:
            LOGGER.warning('Channel %s was closed: (%s) %s',
                           channel, reply_code, reply_text)
            self.state = self.STATE_BLOCKED
            if self.on_unavailable:
                self.on_unavailable(self)
            self.channel = self._open_channel()