code: def dataset_iterator(x, preproc, bs):
      """iterate over the lines of x in blocks of size bs"""
  
      nb = x.shape[0]
      block_ranges = [(i0, min(nb, i0 + bs)) for i0 in range(0, nb, bs)]
  
      def prepare_block(i01):
          i0, i1 = i01
          xb = sanitize(x[i0:i1])
          return i0, preproc.apply_py(xb)
  
      return rate_limited_imap(prepare_block, block_ranges)
  
imports: from __future__ import print_function
  import numpy
  import time
  import os
  import sys
  import faiss
  import re
  from multiprocessing.pool import ThreadPool
  from datasets import ivecs_read
label_desc: Use image node_id 6 for calling a global function with example usage: dataset_iterator(x, preproc, bs) and returns: rate_limited_imap, i0,  preproc