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, criterion_v) in six.iteritems(criteria):
            (
                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,
                            "  pattern: %s" % criterion_pattern,
                            "  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

        Return true if the rule is applicable to the provided trigger instance.

        :rtype: ``bool``
        
st2reactor/st2reactor/rules/filter.py