docs: def set_iterable_type(obj):
      ''' Returns either a generator or a list depending on config-level
      settings. Should be used to wrap almost every internal iterable return.
      Also inspects elements recursively in the case of list returns, to
      ensure that there are no nested generators. '''
      if not isiterable(obj):
          return obj
  
      if config.get_option('use_generators'):
          return obj if isgenerator(obj) else (i for i in obj)
      else:
          return [set_iterable_type(i) for i in obj]