def complete_rules(rules, cmd):
 if (not isinstance(rules, list)):
  rules = [rules]
 ret = []
 for r in rules:
  ret += complete_rule(r, cmd)
 return ret

def complete_rules ( rules , cmd ) : if ( not isinstance ( rules , list ) ) : rules = [ rules ] ret = [ ] for r in rules : ret += complete_rule ( r , cmd ) return ret
complete using a list of completion rules .