def _read_postgres_gucs_validators_file(file: PathLikeObj) -> Dict[str, Any]:
    """Read an YAML file and return the corresponding Python object.

    :param file: path-like object to read from. It is expected to be encoded with ``UTF-8``, and to be a YAML document.

    :returns: the YAML content parsed into a Python object. If any issue is faced while reading/parsing the file, then
        return ``None``.

    :raises:
        :class:`InvalidGucValidatorsFile`: if faces an issue while reading or parsing *file*.
    """
    try:
        with file.open(encoding='UTF-8') as stream:
            return yaml.safe_load(stream)
    except Exception as exc:
        raise InvalidGucValidatorsFile(
            f'Unexpected issue while reading parameters file `{file}`: `{str(exc)}`.') from exc
Read an YAML file and return the corresponding Python object.

    :param file: path-like object to read from. It is expected to be encoded with ``UTF-8``, and to be a YAML document.

    :returns: the YAML content parsed into a Python object. If any issue is faced while reading/parsing the file, then
        return ``None``.

    :raises:
        :class:`InvalidGucValidatorsFile`: if faces an issue while reading or parsing *file*.
    
patroni/postgresql/validator.py