code: def test_data_iterator_csv_dataset(
      test_data_csv_png_10,
      test_data_csv_png_20,
      size,
      batch_size,
      shuffle,
      use_thread,
      normalize,
      with_memory_cache,
      with_file_cache,
      with_context,
      stop_exhausted,
  ):
      nnabla_config.set(
          "DATA_ITERATOR", "data_source_file_cache_size", "3"
      )
      nnabla_config.set(
          "DATA_ITERATOR", "data_source_buffer_max_size", "10000"
      )
      nnabla_config.set(
          "DATA_ITERATOR", "data_source_buffer_num_of_data", "9"
      )
  
      if size == 10:
          csvfilename = test_data_csv_png_10
      elif size == 20:
          csvfilename = test_data_csv_png_20
  
      logger.info(csvfilename)
  
      main_thread = threading.current_thread().ident
      expect_epoch = [0]
  
      def end_epoch(epoch):
          if batch_size // size == 0:
              assert (
                  epoch == expect_epoch[0]
              ), "Failed for end epoch check"
          else:
              print(f"E: {epoch} <--> {expect_epoch[0]}")
          assert (
              threading.current_thread().ident == main_thread
          ), "Failed for thread checking"
  
      def begin_epoch(epoch):
          if batch_size // size == 0:
              assert (
                  epoch == expect_epoch[0]
              ), "Failed for begin epoch check"
          else:
              print(f"B: {epoch} <--> {expect_epoch[0]}")
          assert (
              threading.current_thread().ident == main_thread
          ), "Failed for thread checking"
  
      if with_context:
          with data_iterator_csv_dataset(
              uri=csvfilename,
              batch_size=batch_size,
              shuffle=shuffle,
              normalize=normalize,
              with_memory_cache=with_memory_cache,
              with_file_cache=with_file_cache,
              use_thread=use_thread,
              stop_exhausted=stop_exhausted,
          ) as di:
              di.register_epoch_end_callback(begin_epoch)
              di.register_epoch_end_callback(end_epoch)
              check_data_iterator_result(
                  di,
                  batch_size,
                  shuffle,
                  normalize,
                  stop_exhausted,
                  expect_epoch,
              )
      else:
          di = data_iterator_csv_dataset(
              uri=csvfilename,
              batch_size=batch_size,
              shuffle=shuffle,
              normalize=normalize,
              with_memory_cache=with_memory_cache,
              with_file_cache=with_file_cache,
              use_thread=use_thread,
              stop_exhausted=stop_exhausted,
          )
          di.register_epoch_end_callback(begin_epoch)
          di.register_epoch_end_callback(end_epoch)
          check_data_iterator_result(
              di,
              batch_size,
              shuffle,
              normalize,
              stop_exhausted,
              expect_epoch,
          )
          di.close()
  
imports: from __future__ import absolute_import
  import os
  import pytest
  import threading
  import numpy
  from nnabla.logger import logger
  from nnabla.config import nnabla_config
  from nnabla.utils.data_source_loader import load_image
  from nnabla.utils.data_iterator import data_iterator_csv_dataset
  from nnabla.utils.data_iterator import data_iterator_simple
  from nnabla.utils.data_iterator import data_iterator_concat_datasets
  from nnabla.utils.data_source_implements import CsvDataSource
  from .conftest import test_data_csv_png_10, test_data_csv_png_20
label_desc: Use image node_id 4 for calling a global function with example usage: test_data_iterator_csv_dataset(test_data_csv_png_10, test_data_csv_png_20, size, batch_size, shuffle, use_thread, normalize, with_memory_cache, with_file_cache, with_context, stop_exhausted) without return types