from typing import Dict
from typing import Any
import yaml
import json


def load_config_file(path: str) -> Dict[str, Any]:
    """Load a YAML file into a dict.
    Extensions accepted are `{.yml, .yaml}`.

    Arguments:
        path: The relative path to the YAML file to load.

    Returns:
        A dict version of the YAML file.
    """
    file_ext = path.split('.')[-1]
    if file_ext in {'yml', 'yaml'}:
        with open(path, 'rb') as file:
            config = yaml.load(file, Loader=yaml.FullLoader)
    elif file_ext == 'json':
        config = json.loads(path)
    else:
        raise NotImplementedError('unrecognized file extension .{:s} for file {:s}'.format(file_ext, path))
    return config