def METHOD_NAME(path: Path):
    with open(str(path), "r") as file:
        file_data = file.read()
        file_ext = path.suffix
        if file_ext == ".json":
            return json.loads(file_data)
        elif file_ext == ".yaml":
            return load(file_data, Loader=Loader)
        else:
            raise RuntimeError("path must be a '.yaml' or '.json' file")