def compare(self, lhs_value, rhs_value):
if self.is_eq():<EOL><INDENT>return lhs_value is not None and lhs_value == rhs_value<EOL><DEDENT>if self.is_neq():<EOL><INDENT>return lhs_value is not None and lhs_value != rhs_value  <EOL><DEDENT>if self.is_exists():<EOL><INDENT>if rhs_value:<EOL><INDENT>return lhs_value is not None<EOL><DEDENT>else:<EOL><INDENT>return lhs_value is None<EOL><DEDENT><DEDENT>if self.is_size():<EOL><INDENT>if self.is_size_eq() or self.is_size_var():<EOL><INDENT>return lhs_value == rhs_value<EOL><DEDENT>if self.is_size_gt():<EOL><INDENT>return lhs_value > rhs_value<EOL><DEDENT>if self.is_size_lt():<EOL><INDENT>return lhs_value < rhs_value<EOL><DEDENT>raise RuntimeError('<STR_LIT>'.format(self._op))<EOL><DEDENT>if self.is_inequality():<EOL><INDENT>if not isinstance(lhs_value, Number):<EOL><INDENT>return False<EOL><DEDENT>py_op = self.PY_INEQ.get(self._op, self._op)<EOL>return eval('<STR_LIT>'.format(lhs_value, py_op, rhs_value))<EOL><DEDENT>if self.is_type():<EOL><INDENT>ltype = type(lhs_value)<EOL>if rhs_value is Number:<EOL><INDENT>return ltype in (int, float)<EOL><DEDENT>elif rhs_value is str:<EOL><INDENT>return ltype is str<EOL><DEDENT>elif rhs_value is bool:<EOL><INDENT>return ltype is bool<EOL><DEDENT>return False<EOL><DEDENT>if self.is_regex():<EOL><INDENT>m = rhs_value.match(lhs_value)<EOL>return m is not None<EOL><DEDENT>
Compare left- and right-size of: value <op> value.

        :param lhs_value: Value to left of operator
        :param rhs_value: Value to right of operator
        :return: True if the comparison is valid
        :rtype: bool