def resolve_monkey(self, sst, name, action, force=False,
                   node_type=None):  # pragma: no cover
    if not force and not node_type:
        try:
            type, subtype = self.address_cache[name]
            action(type, subtype)
            return
        except __HOLE__:
            pass
    args = []

    def do_result(r):
        args.append(r)

    def do_action(r):
        do_result(r)
        er, qr = args
        if node_type == 'topic' and not er.not_found:
            type, subtype = 'topic', er.type
        elif node_type == 'queue' and qr.queue:
            type, subtype = 'queue', None
        elif er.not_found and not qr.queue:
            type, subtype = None, None
        elif qr.queue:
            type, subtype = 'queue', None
        else:
            type, subtype = 'topic', er.type
        if type is not None:
            self.address_cache[name] = (type, subtype)
        action(type, subtype)

    sst.write_query(ExchangeQuery(name), do_result)
    sst.write_query(QueueQuery(name), do_action)


# Apply monkey patch 2
dataset/ETHPy150Open celery/kombu/kombu/transport/qpid_patches.py/resolve_monkey