code: def get_model_info(
      model: str,
      repo: str = "onnx/models:main",
      opset: Optional[int] = None,
  ) -> ModelInfo:
      """
      Gets the model info matching the given name and opset.
  
      :param model: The name of the onnx model in the manifest. This field is case-sensitive
      :param repo: The location of the model repo in format "user/repo[:branch]".
          If no branch is found will default to "main"
      :param opset: The opset of the model to get. The default of `None` will return the model with largest opset.
      :return: ModelInfo
      """
      matching_models = list_models(repo, model)
      if not matching_models:
          raise AssertionError(f"No models found with name {model}")
  
      if opset is None:
          selected_models = sorted(
              matching_models, key=lambda m: -m.opset
          )
      else:
          selected_models = [
              m for m in matching_models if m.opset == opset
          ]
          if len(selected_models) == 0:
              valid_opsets = [m.opset for m in matching_models]
              raise AssertionError(
                  f"{model} has no version with opset {opset}. Valid opsets: {valid_opsets}"
              )
      return selected_models[0]
  
imports: import hashlib
  import json
  import os
  import sys
  import tarfile
  from io import BytesIO
  from os.path import join
  from typing import IO, Any, Dict, List, Optional, Set, Tuple, cast
  from urllib.error import HTTPError
  from urllib.request import urlopen
  import onnx
label_desc: Use image node_id 8 for calling a global function with example usage: get_model_info(model, repo, opset) and returns: selected_models