code: def load_yaml(stream, typ: str = "safe"):
      """
      Load the YAML document in a stream as Python object.
  
      Args:
          stream:
              The YAML file loaded in a stream.
          typ:
              The type of Dumper/Loader to apply in ruamel.yaml.
  
      Returns:
          The YAML laoded as python object.
      """
      yaml = YAML(typ=typ)
      data = yaml.load(stream=stream)
      if not isinstance(data, dict):
          raise ValueError(
              "The loaded data should be a dict, please check your yaml source.\
              (Such error is very likely caused by using dash instead of underline in yaml file name.)"
          )
  
      return data
  
imports: import io
  from typing import Union, Dict, List
label_desc: Use image node_id 1 for calling a global function with example usage: load_yaml(stream, typ) and returns: data