code: def consume(self, callback, bindings, queues):
          
          expanded_bindings = collections.defaultdict(list)
          for binding in bindings:
              for key in binding["routing_keys"]:
                  b = binding.copy()
                  del b["routing_keys"]
                  b["routing_key"] = key
                  expanded_bindings[b["queue"]].append(b)
  
          expanded_queues = []
          for name, settings in queues.items():
              q = {"queue": name}
              q.update(settings)
              expanded_queues.append(q)
  
          protocol = yield self.when_connected()
  
          consumers = []
          for queue in expanded_queues:
              yield protocol.declare_queues([queue])
              b = expanded_bindings.get(queue["queue"], [])
              yield protocol.bind_queues(b)
              consumer = yield protocol.consume(callback, queue["queue"])
              self._consumers[queue["queue"]] = (consumer, queue, b)
              consumers.append(consumer)
  
          defer.returnValue(consumers)
docs: Start a consumer that lasts across individual connections.
  
          Args:
              callback (callable): A callable object that accepts one positional argument,
                  a :class:`Message` or a class object that implements the ``__call__``
                  method. The class will be instantiated before use.
              bindings (dict or list of dict): Bindings to declare before consuming. This
                  should be the same format as the :ref:`conf-bindings` configuration.
              queues (dict): The queues to declare and consume from. Each key in this
                  dictionary is a queue, and each value is its settings as a dictionary.
                  These settings dictionaries should have the "durable", "auto_delete",
                  "exclusive", and "arguments" keys. Refer to :ref:`conf-queues` for
                  details on their meanings.
  
          Returns:
              defer.Deferred:
                  A deferred that fires with the list of one or more
                  :class:`fedora_messaging.twisted.consumer.Consumer` objects.
                  These can be passed to the
                  :meth:`FedoraMessagingFactoryV2.cancel` API to halt them. Each
                  consumer object has a ``result`` instance variable that is a
                  Deferred that fires or errors when the consumer halts. The
                  Deferred may error back with a BadDeclaration if the user does
                  not have permissions to consume from the queue.