code: def get_dir_walker(recursive, topdown=True, followlinks=False):
      
      if recursive:
          walk = partial(os.walk, topdown=topdown, followlinks=followlinks)
      else:
          def walk(path, topdown=topdown, followlinks=followlinks):
              try:
                  yield next(os.walk(path, topdown=topdown, followlinks=followlinks))
              except NameError:
                  yield os.walk(path, topdown=topdown, followlinks=followlinks).next() #IGNORE:E1101
      return walk
docs: Returns a recursive or a non-recursive directory walker.
  
      :param recursive:
          ``True`` produces a recursive walker; ``False`` produces a non-recursive
          walker.
      :returns:
          A walker function.