code: def create_mnbn_model(link, comm):
      """Returns a copy of a model with BN replaced by Multi-node BN."""
      if isinstance(link, chainer.links.BatchNormalization):
          mnbn = chainermn.links.MultiNodeBatchNormalization(
              size=link.avg_mean.shape,
              comm=comm,
              decay=link.decay,
              eps=link.eps,
              dtype=link.avg_mean.dtype,
              use_gamma=hasattr(link, "gamma"),
              use_beta=hasattr(link, "beta"),
          )
          mnbn.copyparams(link)
          for name in link._persistent:
              mnbn.__dict__[name] = copy.deepcopy(link.__dict__[name])
          return mnbn
      elif isinstance(link, chainer.Chain):
          new_children = [
              (
                  child_name,
                  create_mnbn_model(link.__dict__[child_name], comm),
              )
              for child_name in link._children
          ]
          new_link = copy.deepcopy(link)
          for name, new_child in new_children:
              new_link.__dict__[name] = new_child
          return new_link
      elif isinstance(link, chainer.ChainList):
          new_children = [create_mnbn_model(l, comm) for l in link]
          new_link = copy.deepcopy(link)
          for i, new_child in enumerate(new_children):
              new_link._children[i] = new_child
          return new_link
      else:
          return copy.deepcopy(link)
  
imports: import argparse
  import copy
  import multiprocessing
  import numpy
  import chainer
  import chainer.functions
  import chainer.links
  from chainer import training
  from chainer.training import extensions
  from chainer.training.extensions import PolynomialShift
  from chainercv.datasets import ade20k_semantic_segmentation_label_names
  from chainercv.datasets import ADE20KSemanticSegmentationDataset
  from chainercv.datasets import cityscapes_semantic_segmentation_label_names
  from chainercv.datasets import CityscapesSemanticSegmentationDataset
  from chainercv.experimental.links import PSPNetResNet101
  from chainercv.experimental.links import PSPNetResNet50
  from chainercv.chainer_experimental.datasets.sliceable import TransformDataset
  from chainercv.extensions import SemanticSegmentationEvaluator
  from chainercv.links import Conv2DBNActiv
  from chainercv import transforms
  from chainercv.links.model.ssd import GradientScaling
  import PIL
  import chainermn
label_desc: Use image node_id 1 for calling a global function with example usage: create_mnbn_model(link, comm) and returns: mnbn, new_link, new_link, copy