docs: def directory_generator(dirname, trim=0):
      """
      yields a tuple of (relative filename, chunking function). The
      chunking function can be called to open and iterate over the
      contents of the filename.
      """
  
      def gather(collect, dirname, fnames):
          for fname in fnames:
              df = join(dirname, fname)
              if not isdir(df):
                  collect.append(df)
  
      collect = list()
      walk(dirname, gather, collect)
      for fname in collect:
          yield fname[trim:], file_chunk(fname)