def match_property(self, candidate, criterion):
        """ Helper method to match a property following some criterion.
            Turns the value into a regular expression.
        """
        if not criterion:
            return False
        name = criterion.get("name")
        value = getattr(candidate, name)
        negative = criterion.get("negative", False)
        expr = re.compile(criterion.get("value"), re.IGNORECASE)
        # support single values or list of values
        if type(value) is not list:
            value = [value]
        # if negative, reverse the condition
        if negative:
            return all([
                not expr.match(str(v))
                for v in value
            ])
        # otherwise do match for any values in the list
        return any([
            expr.match(str(v))
            for v in value
        ])
 Helper method to match a property following some criterion.
            Turns the value into a regular expression.
        
powerfulseal/policy/action_nodes_pods.py