code: def _chunk_iter_progress(it, log, prefix):
      
      n_variants = 0
      before_all = time.time()
      before_chunk = before_all
      for chunk, chunk_length, chrom, pos in it:
          after_chunk = time.time()
          elapsed_chunk = after_chunk - before_chunk
          elapsed = after_chunk - before_all
          n_variants += chunk_length
          chrom = text_type(chrom, 'utf8')
          message = (
              '%s %s rows in %.2fs; chunk in %.2fs (%s rows/s)' %
              (prefix, n_variants, elapsed, elapsed_chunk,
               int(chunk_length // elapsed_chunk))
          )
          if chrom:
              message += '; %s:%s' % (chrom, pos)
          print(message, file=log)
          log.flush()
          yield chunk, chunk_length, chrom, pos
          before_chunk = after_chunk
      after_all = time.time()
      elapsed = after_all - before_all
      print('%s all done (%s rows/s)' %
            (prefix, int(n_variants // elapsed)), file=log)
      log.flush()
docs: Wrap a chunk iterator for progress logging.