+ elif isinstance(c, list):
+ return expand_list(p, c)
+ elif isinstance(c, basestring):
+ return [subst.do_substitution(p, c)]
+
+ return []
+
+def expand_list(p, l):
+ if isinstance(l, basestring):
+ return expand_item(p, l)
+ else:
+ return [exp for arg in l for exp in expand_item(p, arg)]
+
+def add_to_group(gr, match):
+ m = ('^_^').join(match.groups())
+ if m not in gr:
+ gr[m] = []
+ gr[m].append(match.group(0))
+
+def get_items(p, value):
+ if isinstance(value, dict):
+ return expand_list(p, value)