code: def load_yaml_with_sanity_check(yaml_file):
      """Load yaml and do sanity check. Internal use only."""
      with open(yaml_file) as f:
          yaml_data = yaml.load(f, Loader=yaml.loader.SafeLoader)
          try:
              meta_yaml = MetaYaml(**yaml_data)
          except dt.ValidationError as e:
              print(
                  "Details of pydantic.ValidationError:\n{}".format(
                      e.json()
                  )
              )
              raise DGLError(
                  "Validation Error for YAML fields. Details are shown above."
              )
          if meta_yaml.version != "1.0.0":
              raise DGLError(
                  "Invalid CSVDataset version {}. Supported versions: '1.0.0'".format(
                      meta_yaml.version
                  )
              )
          ntypes = [meta.ntype for meta in meta_yaml.node_data]
          if len(ntypes) > len(set(ntypes)):
              raise DGLError(
                  "Each node CSV file must have a unique node type name, but found duplicate node type: {}.".format(
                      ntypes
                  )
              )
          etypes = [tuple(meta.etype) for meta in meta_yaml.edge_data]
          if len(etypes) > len(set(etypes)):
              raise DGLError(
                  "Each edge CSV file must have a unique edge type name, but found duplicate edge type: {}.".format(
                      etypes
                  )
              )
          return meta_yaml
  
imports: import ast
  import os
  from typing import Callable, List, Optional
  import numpy
  import pandas
  import pydantic
  import yaml
  from ..None import backend
  from ..base import dgl_warning, DGLError
  from ..convert import heterograph
label_desc: Use image node_id 1 for calling a global function with example usage: load_yaml_with_sanity_check(yaml_file) and returns: meta_yaml