code: def declare_exchanges(self, exchanges):
          
          channel = yield self._allocate_channel()
          try:
              for exchange in exchanges:
                  args = exchange.copy()
                  args.setdefault("passive", config.conf["passive_declares"])
                  try:
                      yield channel.exchange_declare(**args)
                  except pika.exceptions.ChannelClosed as e:
                      raise BadDeclaration("exchange", args, e)
          finally:
              try:
                  channel.close()
              except pika.exceptions.AMQPError:
                  pass
docs: Declare a number of exchanges at once.
  
          This simply wraps the :meth:`pika.channel.Channel.exchange_declare`
          method and deals with error handling and channel allocation.
  
          Args:
              exchanges (list of dict): A list of dictionaries, where each dictionary
                  represents an exchange. Each dictionary can have the following keys:
  
                    * exchange (str): The exchange's name
                    * exchange_type (str): The type of the exchange ("direct", "topic", etc)
                    * passive (bool): If true, this will just assert that the exchange exists,
                      but won't create it if it doesn't. Defaults to the configuration value
                      :ref:`conf-passive-declares`
                    * durable (bool): Whether or not the exchange is durable
                    * arguments (dict): Extra arguments for the exchange's creation.
          Raises:
              NoFreeChannels: If there are no available channels on this connection.
                  If this occurs, you can either reduce the number of consumers on this
                  connection or create an additional connection.
              BadDeclaration: If an exchange could not be declared. This can occur
                  if the exchange already exists, but does its type does not match
                  (e.g. it is declared as a "topic" exchange, but exists as a "direct"
                  exchange). It can also occur if it does not exist, but the current
                  user does not have permissions to create the object.