code: def _to_distiller_modulelist(model):
      """Replaces all instances of torch.nn.ModuleList in a model with DistillerModuleList instances
  
      Args:
          model (torch.nn.Module): Model to convert
      """
  
      def convert_container(container):
          # To maintain a similar order of registered modules compared to the original container, we unregister
          # all modules and then register them again
          # We take care to include duplicated modules, which are not returned by the original named_moduels/children
          # implementation in torch.nn.Module
          named_children = OrderedDict(
              _named_children_with_duplicates(container)
          )
          for n, _ in named_children.items():
              delattr(container, n)
          for name, child in named_children.items():
              if isinstance(child, nn.ModuleList):
                  child = _DistillerModuleList(name, container, child)
                  to_check = child.modules()
              else:
                  to_check = [child]
              setattr(container, name, child)
              for m in to_check:
                  if isinstance(m, _DistillerModuleList):
                      continue
                  if distiller.has_children(m):
                      convert_container(m)
          return container
  
      named_modules_orig = OrderedDict(
          [
              (n, m)
              for n, m in _named_modules_with_duplicates(model)
              if not isinstance(m, nn.ModuleList)
          ]
      )
      model = convert_container(model)
      named_modules_dmlist = OrderedDict(
          _named_modules_with_duplicates(model)
      )
      converted_module_names_map = OrderedDict(
          zip(named_modules_dmlist.keys(), named_modules_orig.keys())
      )
  
      return model, converted_module_names_map
  
imports: from .None import distiller
  import re
  import numpy
  import collections
  import torch
  import torch.nn
  import torch.jit
  import logging
  from collections import OrderedDict, defaultdict
  from collections.abc import MutableSequence, Iterable
label_desc: Use image node_id 4 for calling a global function with example usage: _to_distiller_modulelist(model) and returns: model,  converted_module_names_map, container