code: def dict_from_config_file(
      filename: str, must_exist: bool = False
  ) -> Optional[Dict[str, Any]]:
      if not os.path.exists(filename):
          if must_exist:
              raise ConfigError(
                  "config file %s doesn't exist" % filename
              )
          logger.debug("no default config file found in %s" % filename)
          return None
      try:
          conf_file = open(filename)
      except OSError:
          raise ConfigError("Couldn't read config file: %s" % filename)
      try:
          loaded = load_yaml(conf_file)
      except yaml.parser.ParserError:
          raise ConfigError("Invalid YAML in config yaml")
      if loaded is None:
          wandb.termwarn(
              "Found an empty default config file (config-defaults.yaml). Proceeding with no defaults."
          )
          return None
      config_version = loaded.pop("wandb_version", None)
      if config_version is not None and config_version != 1:
          raise ConfigError("Unknown config version")
      data = dict()
      for k, v in loaded.items():
          data[k] = v["value"]
      return data
  
file_path: wandb/wandb/sdk/lib/config_util.py
imports: import json
  import logging
  import os
  from typing import Any, Dict, Optional
  import yaml
  import wandb
  from wandb.errors import Error
  from wandb.util import load_yaml
  from .None import filesystem
label_desc: Use image node_id 7 for calling a global function with example usage: dict_from_config_file(filename, must_exist) and returns: data, None, None