code: def transfer_verification(
      model_state_dict, partial_state_dict, modules
  ):
      """Verify tuples (key, shape) for input model modules match specified modules.
  
      Args:
          model_state_dict (Dict) : Main model state dict.
          partial_state_dict (Dict): Pre-trained model state dict.
          modules (List): Specified module(s) to transfer.
  
      Return:
          (bool): Whether transfer learning is allowed.
  
      """
      model_modules = []
      partial_modules = []
  
      for key_m, value_m in model_state_dict.items():
          if any(key_m.startswith(m) for m in modules):
              model_modules += [(key_m, value_m.shape)]
      model_modules = sorted(model_modules, key=lambda x: (x[0], x[1]))
  
      for key_p, value_p in partial_state_dict.items():
          if any(key_p.startswith(m) for m in modules):
              partial_modules += [(key_p, value_p.shape)]
      partial_modules = sorted(
          partial_modules, key=lambda x: (x[0], x[1])
      )
  
      module_match = model_modules == partial_modules
  
      if not module_match:
          logging.error(
              "Some specified modules from the pre-trained model "
              "don't match with the new model modules:"
          )
          logging.error(
              f"Pre-trained: {set(partial_modules) - set(model_modules)}"
          )
          logging.error(
              f"New model: {set(model_modules) - set(partial_modules)}"
          )
          exit(1)
  
      return module_match
  
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 2 for calling a global function with example usage: transfer_verification(model_state_dict, partial_state_dict, modules) and returns: module_match