code: def consume(self, callback, bindings=None, queues=None, exchanges=None):
          
          self._bindings = bindings or config.conf["bindings"]
          self._queues = queues or config.conf["queues"]
          self._exchanges = exchanges or config.conf["exchanges"]
  
          # If the callback is a class, create an instance of it first
          if inspect.isclass(callback):
              cb_obj = callback()
              if not callable(cb_obj):
                  raise ValueError(
                      "Callback must be a class that implements __call__"
                      " or a function."
                  )
              self._consumer_callback = cb_obj
          elif callable(callback):
              self._consumer_callback = callback
          else:
              raise ValueError(
                  "Callback must be a class that implements __call__" " or a function."
              )
          self._running = True
          self.connect()
          self._connection.ioloop.start()
docs: Consume messages from a message queue.
  
          Simply define a callable to be used as the callback when messages are
          delivered and specify the queue bindings. This call blocks. The callback
          signature should accept a single positional argument which is an
          instance of a :class:`Message` (or a sub-class of it).
  
          Args:
              callback (callable): The callable to pass the message to when one
                  arrives.
              bindings (list of dict): A list of dictionaries describing bindings
                  for queues. Refer to the :ref:`conf-bindings` configuration
                  documentation for the format.
              queues (dict): A dictionary of queues to ensure exist. Refer to the
                  :ref:`conf-queues` configuration documentation for the format.
              exchanges (dict): A dictionary of exchanges to ensure exist. Refer
                  to the :ref:`conf-exchanges` configuration documentation for the
                  format.
  
          Raises:
              HaltConsumer: Raised when the consumer halts.
              ValueError: If the callback isn't a callable object or a class with
                  __call__ defined.