code: def expand(sequence):
      
      expanse = []
      for point in sequence:
          if 'sequence' in point:
              expanse.extend(expand(point['sequence']))
          else:
              expanse.append(point)
      return sequence.__class__(expanse)
docs: expands a tree of sequences into a single, flat sequence, recursively.