'Probe whether the value pair matches the query
@param l: the left value
@param r: the right value'

def _probe(self, op, l, r):

    result = False
    convert = S3TypeConverter.convert
    if (op == self.TYPEOF):
        if isinstance(l, (list, tuple, set)):
            op = self.ANYOF
        elif isinstance(r, (list, tuple, set)):
            op = self.BELONGS
        else:
            op = self.EQ
    if (op == self.CONTAINS):
        r = convert(l, r)
        result = self._probe_contains(l, r)
    elif (op == self.ANYOF):
        if (not isinstance(r, (list, tuple, set))):
            r = [r]
        for v in r:
            if isinstance(l, (list, tuple, set, basestring)):
                if self._probe_contains(l, v):
                    return True
            elif (l == v):
                return True
        return False
    elif (op == self.BELONGS):
        if (not isinstance(r, (list, tuple, set))):
            r = [r]
        r = convert(l, r)
        result = self._probe_contains(r, l)
    elif (op == self.LIKE):
        pattern = re.escape(str(r)).replace('\\%', '.*').replace('.*.*', '\\%')
        return (re.match(pattern, str(l)) is not None)
    else:
        r = convert(l, r)
        if (op == self.LT):
            result = (l < r)
        elif (op == self.LE):
            result = (l <= r)
        elif (op == self.EQ):
            result = (l == r)
        elif (op == self.NE):
            result = (l != r)
        elif (op == self.GE):
            result = (l >= r)
        elif (op == self.GT):
            result = (l > r)
    return result
