code: def filter_modules(model_state_dict, modules):
      """Filter non-matched modules in model state dict.
  
      Args:
          model_state_dict (Dict): Pre-trained model state dict.
          modules (List): Specified module(s) to transfer.
  
      Return:
          new_mods (List): Filtered module list.
  
      """
      new_mods = []
      incorrect_mods = []
  
      mods_model = list(model_state_dict.keys())
      for mod in modules:
          if any(key.startswith(mod) for key in mods_model):
              new_mods += [mod]
          else:
              incorrect_mods += [mod]
  
      if incorrect_mods:
          logging.error(
              "Specified module(s) don't match or (partially match) "
              f"available modules in model. You specified: {incorrect_mods}."
          )
          logging.error("The existing modules in model are:")
          logging.error(f"{mods_model}")
          exit(1)
  
      return new_mods
  
file_path: espnet/espnet/asr/pytorch_backend/asr_init.py
imports: import logging
  import os
  import re
  from collections import OrderedDict
  import torch
  from espnet.asr.asr_utils import get_model_conf, torch_load
  from espnet.nets.asr_interface import ASRInterface
  from espnet.nets.mt_interface import MTInterface
  from espnet.nets.pytorch_backend.transducer.utils import custom_torch_load
  from espnet.nets.tts_interface import TTSInterface
  from espnet.utils.dynamic_import import dynamic_import
label_desc: Use image node_id 5 for calling a global function with example usage: filter_modules(model_state_dict, modules) and returns: new_mods