code: def test_MNISTIter(tmpdir):
      # prepare data
      path = str(tmpdir)
      get_mnist_ubyte(path)
  
      batch_size = 100
      train_dataiter = mx.io.MNISTIter(
          image=os.path.join(path, "train-images-idx3-ubyte"),
          label=os.path.join(path, "train-labels-idx1-ubyte"),
          data_shape=(784,),
          batch_size=batch_size,
          shuffle=1,
          flat=1,
          silent=0,
          seed=10,
      )
      # test_loop
      nbatch = 60000 / batch_size
      batch_count = 0
      for _ in train_dataiter:
          batch_count += 1
      assert nbatch == batch_count
      # test_reset
      train_dataiter.reset()
      train_dataiter.iter_next()
      label_0 = train_dataiter.getlabel().asnumpy().flatten()
      train_dataiter.iter_next()
      train_dataiter.iter_next()
      train_dataiter.iter_next()
      train_dataiter.iter_next()
      train_dataiter.reset()
      train_dataiter.iter_next()
      label_1 = train_dataiter.getlabel().asnumpy().flatten()
      assert sum(label_0 - label_1) == 0
      mx.nd.waitall()
  
imports: import mxnet
  import mxnet.ndarray
  from mxnet.test_utils import *
  from mxnet.base import MXNetError
  import numpy
  import os
  import gzip
  import pickle
  import time
  import sys
  from common import assertRaises
  import pytest
  from itertools import zip_longest
label_desc: Use image node_id 2 for calling a global function with example usage: test_MNISTIter(tmpdir) without return types