Check if the user has permission to perform a given action on an object

def can(self, action, subject, **conditions):
        """
        Check if the user has permission to perform a given action on an object
        """
        for rule in self.relevant_rules_for_match(action, subject):
            if rule.matches_conditions(action, subject, **conditions):
                return rule.base_behavior
        return False