def close(self, reply_code=200, reply_text='Normal shutdown'):
        if self.is_closed:
            LOGGER.debug('Close called on closed connection (%s): %s',
                         reply_code, reply_text)
            return

        LOGGER.info('Closing connection (%s): %s', reply_code, reply_text)

        self._user_initiated_close = True

        # Close channels that remain opened
        for impl_channel in pika.compat.dictvalues(self._impl._channels):
            channel = impl_channel._get_cookie()
            if channel.is_open:
                try:
                    channel.close(reply_code, reply_text)
                except exceptions.ChannelClosed as exc:
                    # Log and suppress broker-closed channel
                    LOGGER.warning('Got ChannelClosed while closing channel '
                                   'from connection.close: %r', exc)

        # Close the connection
        self._impl.close(reply_code, reply_text)

        self._flush_output(self._closed_result.is_ready)
Disconnect from RabbitMQ. If there are any open channels, it will
dataset/ETHPy150Open pika/pika/pika/adapters/blocking_connection.py/BlockingConnection.close