import json


def _load_config(config_path):
    """Safely load a config file."""
    with open(config_path, "r") as fid:
        try:
            config = json.load(fid)
        except ValueError:
            # No JSON object could be decoded --> corrupt file?
            msg = (
                "The config file ({}) is not a valid JSON "
                "file and might be corrupted".format(config_path)
            )
            raise RuntimeError(msg)
            config = dict()
    return config