code: def _expand_network(self, network):
      self._parameter_original_names = collections.OrderedDict()
  
      print(" Expanding {}.".format(network.name))
  
      repeat_ids = collections.OrderedDict()
      for ri in network.repeat_info:
          repeat_ids[ri.id] = ri.times
  
      # # Check whether parameter name complies with old rule.
      # self._old_version_param_name = False
      # for param in self._parameters:
      #     for ri in repeat_ids:
      #         m = re.search('{}\[([0-9]+)\]$'.format(ri), param)
      #         if m:
      #             if int(m.group(1)) < repeat_ids[ri]:
      #                 self._old_version_param_name = True
  
      # Expand repeat
      network = self._expand_repeat(network)
  
      functions = []
      for func in network.function:
          functions.append(
              (
                  func.name,
                  func.type,
                  [n for n in func.input],
                  [n for n in func.output],
              )
          )
  
      sorted_functions = self._sort_functions(functions)
      func_list = []
      for f in functions:
          func_list.append(f[0])
  
      net = nnabla_pb2.NNablaProtoBuf().network.add()
      net.CopyFrom(network)
      net.ClearField("function")
      for f in sorted_functions:
          func = net.function.add()
          func.CopyFrom(network.function[func_list.index(f[0])])
  
      return net
  
file_path: nnabla/python/test/core/legacy_expander.py
imports: import collections
  import re
  from nnabla.utils import nnabla_pb2
label_desc: Use image node_id 3 for calling the NnpExpander obj's underlying member method code with example usage: obj._expand_network(network) and returns: net