'Handle the case where our channel has been closed for us
:param pika.frame.Method method_frame: Method frame with Channel.Close
method'

def _on_close(self, method_frame):

    LOGGER.warning('Received    remote    Channel.Close    (%s):    %r    on    %s', method_frame.method.reply_code, method_frame.method.reply_text, self)
    self._send_method(spec.Channel.CloseOk())
    if self.is_closing:
        self._closing_code_and_text = (method_frame.method.reply_code, method_frame.method.reply_text)
    else:
        self._set_state(self.CLOSED)
        try:
            self.callbacks.process(self.channel_number, '_on_channel_close', self, self, method_frame.method.reply_code, method_frame.method.reply_text)
        finally:
            self._cleanup()
