from typing import Union
import pathlib
import yaml


def read_yaml(file_path: Union[pathlib.Path, str]) -> dict:
    """Read a YAML file and return its contents."""
    with open(file_path, encoding='utf8') as input_file:
        return yaml.load(input_file, Loader=yaml.FullLoader)