code: def test_mn_iterator_change_master(self):
      # Check if it works under rank_master != 0.
      rank_master = 1
      bs = 4
      iterator = chainermn.iterators.create_multi_node_iterator(
          self.iterator_class(
              self.dataset, batch_size=bs, shuffle=True
          ),
          self.communicator,
          rank_master,
      )
  
      for e in range(3):
          for i in range(100):
              batch = iterator.next()
              if self.communicator.rank == rank_master:
                  rank_slaves = [
                      i
                      for i in range(self.communicator.size)
                      if i != rank_master
                  ]
                  for rank_from in rank_slaves:
                      _batch = self.communicator.mpi_comm.recv(
                          source=rank_from
                      )
                      self.assertEqual(batch, _batch)
              else:
                  self.communicator.mpi_comm.ssend(
                      batch, dest=rank_master
                  )
  
imports: import chainer
  import chainer.testing
  import chainer.testing.attr
  import chainermn
  from chainermn.iterators.multi_node_iterator import _build_ctrl_msg
  from chainermn.iterators.multi_node_iterator import _parse_ctrl_msg
  import numpy
  import platform
  import pytest
  from six.moves import range
  import unittest
label_desc: Use image node_id 4 for calling the TestMultiNodeIterator obj's underlying member method code with example usage: obj.test_mn_iterator_change_master() without return types