def InterpolateGrouping(self, pattern):
    components = []
    offset = 0
    for match in GROUPING_PATTERN.finditer(pattern):
      components.append([pattern[offset:match.start()]])

      # Expand the attribute into the set of possibilities:
      alternatives = match.group(1).split(",")
      components.append(set(alternatives))
      offset = match.end()

    components.append([pattern[offset:]])
    # Now calculate the cartesian products of all these sets to form all
    # strings.
    for vector in itertools.product(*components):
      yield u"".join(vector)
Idempotent.
dataset/ETHPy150Open google/grr/grr/lib/rdfvalues/paths.py/GlobExpression.InterpolateGrouping--crossover with--dataset/ETHPy150Open google/vroom/vroom/color.py/Colorless