def METHOD_NAME(self, key: str, val: Union[int, str, List[str], bool]) -> None:
    """
    Set the given key's data to the given value.
    Implements :meth:`AbstractConfig.set`.
    """
    if self._settings is None:
        raise ValueError('attempt to use a closed _settings')
    if not isinstance(val, (bool, str, int, list)):
        raise ValueError(f'Unexpected type for value {type(val)=}')
    self._settings[key] = val