code: def validate_json_schema(
      json_dict: Dict[str, Any], schema_version: Optional[str] = None
  ) -> Dict[str, Any]:
      """Validates the json schema of a model card field.
  
      If schema_version is not provided, it will use the latest schema version.
      See
      https://github.com/tensorflow/model-card-toolkit/tree/main/model_card_toolkit/schema/.
  
      Args:
        json_dict: A dictionary following the schema for a model card field.
        schema_version: The version of the model card schema. Optional field; if
          omitted, defers to the latest schema version.
  
      Returns:
        The schema used for validation.
  
      Raises:
        ValueError: If `schema_version` does not correspond to a model card schema
          version.
        ValidationError: If `model_card_json` does not follow the model card schema.
      """
      schema = _find_json_schema(
          schema_version
          or json_dict.get("schema_version")
          or _LATEST_SCHEMA_VERSION
      )
      jsonschema.validate(json_dict, schema)
      return schema
  
file_path: model-card-toolkit/model_card_toolkit/utils/json_utils.py
imports: import json
  import logging
  import os
  import pkgutil
  from typing import Any, Dict, Optional, Text
  import jsonschema
label_desc: Use image node_id 2 for calling a global function with example usage: validate_json_schema(json_dict, schema_version) and returns: schema