code: def dump_yaml(data: Union[str, Dict, List], stream=None):
      """
      Dump YAML file as python object.
  
      Args:
          data (`Union[str, Dict, List]`):
              The data to write into a YAMl file.
          stream:
              The stream to dump the YAML into.
      """
      yaml = YAML()
      yaml.indent(mapping=4, sequence=8, offset=4)
      yaml.compact_seq_map = False
  
      if stream is None:
          stream = io.StringIO()
          yaml.dump(data=data, stream=stream)
          return stream.getvalue()
      else:
          yaml.dump(data=data, stream=stream)
  
imports: import io
  from typing import Union, Dict, List
label_desc: Use image node_id 2 for calling a global function with example usage: dump_yaml(data, stream) and returns: stream