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


def load_configuration(config_path: str) -> Dict[str, Any]:
    """
    Load a configuration file

    Parameters
    ----------
    config_path: str
        Path to yaml or json configuration file

    Returns
    -------
    dict[str, Any]
        Configuration dictionary
    """
    data = {}
    with open(config_path, "r", encoding="utf8") as f:
        if config_path.endswith(".yaml"):
            data = yaml.load(f, Loader=yaml.SafeLoader)
        elif config_path.endswith(".json"):
            data = json.load(f)
    if not data:
        return {}
    return data