code: def close(self):
          
          LOGGER.debug('Connection Closing')
          if not self.is_closed:
              self.set_state(self.CLOSING)
          self.heartbeat.stop()
          try:
              if not self.is_closed and self.socket:
                  self._channel0.send_close_connection()
                  self._wait_for_connection_state(state=Stateful.CLOSED)
          except AMQPConnectionError:
              pass
          finally:
              self._close_remaining_channels()
              self._io.close()
              self.set_state(self.CLOSED)
          LOGGER.debug('Connection Closed')
docs: Close connection.
  
          :raises AMQPConnectionError: Raises if the connection
                                       encountered an error.
          :return: