docs: def from_yaml(stream, cls=None, loader_cls=yaml.Loader,
                object_pairs_hook=OrderedDict, **extras):
      """
      Convert a YAML stream into a class via the OrderedLoader class.
      """
  
      class OrderedLoader(loader_cls):
          pass
  
      def construct_mapping(loader, node):
          loader.flatten_mapping(node)
          return object_pairs_hook(loader.construct_pairs(node))
  
      OrderedLoader.add_constructor(
          yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG,
          construct_mapping)
  
      yaml_dict = yaml.load(stream, OrderedLoader) or {}
      yaml_dict.update(extras)
      return cls(**yaml_dict) if cls else yaml_dict