def get_exchange_details(self, exchange_node, delete_flag=False, if_unused=True):

        """
        Checking for the existence of an Exchange requires a BlockingConnection...which means if we should delete this
        Exchange just do it while the connection is open.
        """

        results                 = build_dict("FAILED", "Not Found", {})

        try:

            if self.m_channel == None:
                results         = build_dict("FAILED", "Not Connected", {})
            else:
                    
                blocking_ch     = None

                try:
                    durable     = bool(exchange_node["Durable"])
                    exclusive   = bool(exchange_node["Exclusive"])
                    auto_delete = bool(exchange_node["AutoDelete"])

                    # To detect a queue exists there needs to be a blocking connection that will return immediately or throw
        
                    # Setup the Credentials
                    credentials = pika.PlainCredentials(self.m_app_config["Account"]["User"], self.m_app_config["Account"]["Password"])

                    # Setup the Connection Parameters
                    conn_params = pika.ConnectionParameters(
                                        host=self.m_app_config["BrokerAddress"][0],
                                        credentials=credentials)

                    # Setup the Connection
                    connection  = pika.BlockingConnection(conn_params)

                    # Setup the Channel
                    blocking_ch = connection.channel()
                    exch_obj    = blocking_ch.exchange_declare(exchange=str(exchange_node["Name"]), type=str(exchange_node["Type"]).lower().lstrip().strip(), durable=durable, auto_delete=auto_delete, passive=True)
                    
                    if exch_obj != None and exch_obj.method:

                        if delete_flag:
                            blocking_ch.exchange_delete(exchange=str(exchange_node["Name"]), if_unused=if_unused)
                            exch_obj        = blocking_ch.exchange_declare(exchange=str(exchange_node["Name"]), durable=durable, exclusive=exclusive, auto_delete=auto_delete, passive=True)
                            if exch_obj != None and exch_obj.method:
                                self.lg("ERROR: Failed to Delete Exchange(" + str(exchange_node["Name"]) + ") via Flag Deletion", 0)
                                results     = build_dict("SUCCESS", "Found Exchange", {
                                                    "Name"      : str(exchange_node["Name"])
                                                })
                            else:
                                results     = build_dict("SUCCESS", "No Exchange", {
                                                    "Name"      : str(exchange_node["Name"])
                                                })
                            # end of delete confirmation

                        else:
                            results         = build_dict("SUCCESS", "Found Exchange", {
                                                    "Name"      : str(exchange_node["Name"])
                                                })

                    blocking_ch.close()
                except Exception,h:
                    self.lg("Exchange(" + str(exchange_node["Name"]) + ") Exists Ex(" + str(h) + ")", 6)
                    results     = build_dict("SUCCESS", "No Exchange", {})
                # end of try/ex for getting the exchange

        except Exception,k:
            err_msg             = "Failed to run get_exchange_details with Ex(" + str(k) + ")"
            self.lg("ERROR: " + str(err_msg), 0)
            self.m_status       = "Failed"
            results             = build_dict("FAILED", str(err_msg), {})
        # end of try/ex

        return results
    # end of get_exchange_details
dataset/ETHPy150Open GetLevvel/message-simulator/src/rabbit_message_publisher.py/RabbitMessagePublisher.get_exchange_details/original