def filter(self):
        """
        Return true if the rule is applicable to the provided trigger instance.

        :rtype: ``bool``
        """
        LOG.info('Validating rule %s for %s.', self.rule.ref, self.trigger['name'],
                 extra=self._base_logger_context)

        if not self.rule.enabled:
            if self.extra_info:
                LOG.info('Validation failed for rule %s as it is disabled.', self.rule.ref)
            return False

        criteria = self.rule.criteria
        is_rule_applicable = True

        if criteria and not self.trigger_instance.payload:
            return False

        payload_lookup = PayloadLookup(self.trigger_instance.payload)

        LOG.debug('Trigger payload: %s', self.trigger_instance.payload,
                  extra=self._base_logger_context)

        for criterion_k in criteria.keys():
            criterion_v = criteria[criterion_k]
            is_rule_applicable, payload_value, criterion_pattern = self._check_criterion(
                criterion_k, criterion_v, payload_lookup)
            if not is_rule_applicable:
                if self.extra_info:
                    criteria_extra_info = '\n'.join([
                        '  key: %s' % criterion_k,
                        criterion_pattern % '  pattern: %s',
                        '  type: %s' % criterion_v['type'],
                        '  payload: %s' % payload_value
                    ])
                    LOG.info('Validation for rule %s failed on criteria -\n%s', self.rule.ref,
                             criteria_extra_info,
                             extra=self._base_logger_context)
                break

        if not is_rule_applicable:
            LOG.debug('Rule %s not applicable for %s.', self.rule.id, self.trigger['name'],
                      extra=self._base_logger_context)

        return is_rule_applicable
dataset/ETHPy150Open StackStorm/st2/st2reactor/st2reactor/rules/filter.py/RuleFilter.filter/swapped operands of `%`