code: def create_multi_node_iterator(
      actual_iterator, communicator, rank_master=0
  ):
      """Create a multi node iterator from a Chainer iterator.
  
      This iterator shares the same batches on multiple processes, simply
      broadcasting batches from master process to slave processes
      in each iteration.
      Master process obtains batches from ``actual_iterator``, which you can
      specify any Chainer iterator (e.g. ``chainer.iterators.SerialIterator``).
  
      Here is an example situation. When we train a sequence-to-sequence model,
      where the encoder and the decoder is located on two different processes,
      we want to share the same batches on each process, thus inputs for
      the encoder and output teacher signals for the decoder become consistent.
  
      In order to use the multi node iterator, first create the iterator
      from Chainer iterator and ChainerMN communicator::
  
          iterator = chainermn.iterators.create_multi_node_iterator(
              chainer.iterators.SerialIterator(
                  dataset, batch_size, shuffle=True),
              communicator)
  
      Then you can use it as the ordinary Chainer iterator::
  
          updater = chainer.training.StandardUpdater(iterator, optimizer)
          trainer = training.Trainer(updater)
          trainer.run()
  
      Since this iterator shares batches through network in each iteration,
      communication might be large. If you train your model-parallel network
      on extremely large dataset, you can also consider to use
      ``chainermn.iterators.create_synchronized_iterator``.
  
      Current multi node iterator supports numpy.float32 or tuple of
      numpy.float32 as the data type of the batch element.
  
      .. note:: ``create_multi_node_iterator`` and ``serialize`` of created
                iterators must be called at the same time by master and slaves,
                unless it falls into deadlock because they synchronize internal
                states of iterators.
  
      Args:
          actual_iterator: Chainer iterator
              (``chainer.iterators.SerialIterator`` and
              ``chainer.iterators.MultiprocessIterator`` are supported).
          communicator: ChainerMN communicator.
          rank_master: process rank to be master.
  
      Returns:
          The master-slave iterator based on ``actual_iterator``.
      """
      chainer.utils.experimental(
          "chainermn.iterators.create_multi_node_iterator"
      )
      if communicator.rank == rank_master:
          return _MultiNodeIteratorMaster(
              actual_iterator, communicator, rank_master
          )
      else:
          return _MultiNodeIteratorSlave(communicator, rank_master)
  
imports: import chainer
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: create_multi_node_iterator(actual_iterator, communicator, rank_master) and returns: _MultiNodeIteratorMaster, _MultiNodeIteratorSlave