code: def _verify_state_dict(state_dict, expected_keys):
      missing_keys = []
      unexpected_keys = []
      for key in state_dict:
          if key not in expected_keys:
              unexpected_keys.append(key)
      if len(unexpected_keys) > 0:
          raise ValueError(
              f"Found unexpected keys {unexpected_keys} in state_dict: {state_dict}"
          )
      for key in expected_keys:
          if key not in state_dict:
              missing_keys.append(key)
      if len(missing_keys) > 0:
          raise ValueError(
              f"Missing keys {missing_keys} from state_dict: {state_dict}"
          )
  
file_path: coremltools/coremltools/optimize/torch/_utils/state_dict_utils.py
imports: from typing import Any, Dict, Mapping, NamedTuple
  import torch
label_desc: Use image node_id 1 for calling a global function with example usage: _verify_state_dict(state_dict, expected_keys) without return types