def match_rules(rules, app, action):
 for rule in rules.split(','):
  (rule_app, rule_action) = rule.split(':')
  if ((rule_app == '*') or (rule_app == app)):
   if ((rule_action == '*') or (rule_action == action) or (action == '%')):
    return True
 return False

def match_rules ( rules , app , action ) : for rule in rules . split ( ',' ) : ( rule_app , rule_action ) = rule . split ( ':' ) if ( ( rule_app == '*' ) or ( rule_app == app ) ) : if ( ( rule_action == '*' ) or ( rule_action == action ) or ( action == '%' ) ) : return True return False
this will match rules found in group .