def _get_result_set(self):
        """Get the requested value from the oid_base set.

        Matches the value index from the oid_key set specified
        by the key field to retreive the oid_base value.
        """

        class Return(Exception):
            pass

        def filter_result(result, root):
            if isinstance(result, failure.Failure):
                raise Return(result)

            new = {}
            for key, value in result:
                if key.startswith(self.conf[root]):
                    new[key] = value

            if not new:
                raise errors.TestCritical("No values received for %s" % (root,))

            return new

        try:
            base = filter_result(self.query_base.result, "oid_base")
            keys = filter_result(self.query_key.result, "oid_key")
            if self.query_scale:
                scale = filter_result(self.query_scale.result, "oid_scale")
        except Return, ex:
            return ex.args[0]

        final = None
        for oid, value in keys.iteritems():
            if value == self.conf["key"]:
                index = oid[len(self.conf["oid_key"]):]
                final = self.conf['oid_base'] + index
                if self.query_scale:
                    final_scale = self.conf['oid_scale'] + index
                break

        if final is None:
            raise errors.TestCritical("key not found: %r" % self.conf["key"])

        if base not in final:
            raise errors.TestCritical("No value received for %s" % (final,))

        result = base[final]

        if self.query_scale:
            if final_scale not in scale:
                raise errors.TestCritical(
                        "No value received for %s" % (final_scale,))
            scale = scale[final_scale]
            result = self._do_scale(scale, result)

        return str(result)
dataset/ETHPy150Open marineam/nagcat/python/nagcat/plugins/query_snmp.py/SNMPQuery._get_result_set/swapped operands of `not in`