code: def unroll_generators(generator):
      '''
      Take a generator and unroll any sub-generators recursively. This is
      essentially a Python 2 way of doing `yield from` in Python 3 (given
      iterating the entire thing).
      '''
  
      # Ensure we have a generator (prevents ccommands returning lists)
      if not isinstance(generator, GeneratorType):
          raise TypeError('{0} is not a generator'.format(generator))
  
      items = []
  
      for item in generator:
          if isinstance(item, GeneratorType):
              items.extend(unroll_generators(item))
          else:
              items.append(item)
  
      return itemf unroll_generators(generator):
      '''
      Take a generator and unroll any sub-generators recursively. This is
      essentially a Python 2 way of doing `yield from` in Python 3 (given
      iterating the entire thing).
      '''
  
      # Ensure we have a generator (prevents ccommands returning lists)
      if not isinstance(generator, GeneratorType):
          raise TypeError('{0} is not a generator'.format(generator))
  
      items = []
  
      for item in generator:
          if isinstance(item, GeneratorType):
              items.extend(unroll_generators(item))
          else:
              items.append(item)
  
      return items
docs: Take a generator and unroll any sub-generators recursively. This is
      essentially a Python 2 way of doing `yield from` in Python 3 (given
      iterating the entire thing).