code: def verify_all_specified_present(
      model_assets: Optional[List[str]],
      model_versions: List[str],
      selected_models_yaml: List[Dict[str, Any]],
      rule_name: str,
      model_name: str,
      new_style_rule: bool,
  ):
      def find_missing_items(model_items, key, selected_models_yaml):
          missing_items = []
          if not new_style_rule or not model_items:
              return missing_items
          for item in model_items:
              found = False
              for model in selected_models_yaml:
                  if str(model["model"][key]) == item:
                      found = True
              if not found:
                  missing_items.append(item)
          return missing_items
  
      missing_assets = find_missing_items(
          model_assets, "asset", selected_models_yaml
      )
      missing_versions = find_missing_items(
          model_versions, "version", selected_models_yaml
      )
  
      if (
          len(missing_versions) > 0 or len(missing_assets) > 0
      ):  # at least one is missing
          name_warning = ""
          if len(selected_models_yaml) == 0:
              name_warning = (
                  "WARNING: 0 yaml's were found for target rule. This could be because the "
                  + "provided model name: {name} is incorrect. Please check that field as well as "
                  + "the assets and versions."
              ).format(name=model_name)
          raise RuntimeError(
              (
                  "Error: From the pt_operator_library rule for Rule: {name}, at least one entry for the "
                  + "following fields was expected -- Model: {model_name} Expected Assets: {expected_assets}, Expected Versions: "
                  + "{expected_versions}. {name_warning} In all_mobile_models.yaml either no assets were on one of the "
                  + "specified versions, one of the specified assets was not present on any of the specified "
                  + "versions, or both. Assets not found: {missing_assets}, Versions not found: {missing_versions} "
                  + "For questions please ask in https://fb.workplace.com/groups/2148543255442743/"
              ).format(
                  name=rule_name,
                  model_name=model_name,
                  expected_versions=model_versions,
                  expected_assets=model_assets
                  if model_assets
                  else "<All model assets present on specified versions>",
                  name_warning=name_warning,
                  missing_versions=missing_versions
                  if len(missing_versions) > 0
                  else "<All specified versions had at least one asset>",
                  missing_assets=missing_assets
                  if len(missing_assets) > 0
                  else "<All specified assets are present on at least 1 version>",
              )
          )
  
file_path: pytorch/tools/code_analyzer/gen_operators_yaml.py
imports: import argparse
  import json
  import sys
  from typing import Any, Dict, List, Optional
  import yaml
  from gen_op_registration_allowlist import canonical_name, gen_transitive_closure, load_op_dep_graph
  from torchgen.selective_build.operator import merge_operator_dicts, SelectiveBuildOperator
  from torchgen.selective_build.selector import merge_kernel_metadata
label_desc: Use image node_id 4 for calling a global function with example usage: verify_all_specified_present(model_assets, model_versions, selected_models_yaml, rule_name, model_name, new_style_rule) and returns: missing_items, missing_items