def METHOD_NAME(
    mp_path: Union[str, Path],
    path_check: bool = True,
) -> Generator[Dict[str, Any], None, None]:
    """
    Context manager to temporarily set MSTICPYCONFIG path.
    Parameters
    ----------
    mp_path : Union[str, Path]
        Path to msticpy config yaml
    path_check : bool
        If False, skip check for existing file
    Yields
    ------
    Dict[str, Any]
        Custom settings.
    Raises
    ------
    FileNotFoundError
        If mp_path does not exist.
    """
    current_path = os.environ.get(pkg_config._CONFIG_ENV_VAR)
    if path_check and not Path(mp_path).is_file():
        raise FileNotFoundError(f"Setting MSTICPYCONFIG to non-existent file {mp_path}")
    _lock_file_path = "./.mp_settings.lock"
    try:
        with FileLock(_lock_file_path):
            try:
                # We need to lock the settings since these are global
                # Otherwise the tests interfere with each other.
                os.environ[pkg_config._CONFIG_ENV_VAR] = str(mp_path)
                pkg_config.refresh_config()
                yield pkg_config._settings
            finally:
                if not current_path:
                    del os.environ[pkg_config._CONFIG_ENV_VAR]
                else:
                    os.environ[pkg_config._CONFIG_ENV_VAR] = current_path
                pkg_config.refresh_config()
    finally:
        if Path(_lock_file_path).is_file():
            with suppress(Exception):
                Path(_lock_file_path).unlink()