code: def relevant_rules_for_match(self, action, subject):
          
          matches = []
          for rule in self.rules:
              rule.expanded_actions = self.expand_actions(rule.actions)
              if rule.is_relevant(action, subject):
                  matches.append(rule)
  
          return self.optimize(matches[::-1])
docs: retrive match action and subject