from pathlib import Path


def check_access(directory: str) -> bool:
    """Check if the directory is accessible and writeable.

    Parameters
    ----------
    directory
        The directory to be checked

    Returns
    -------
    bool
       Returns True if directory is accessible
    """
    path = Path(directory)
    file = path / "test.txt"
    try:
        file.touch(exist_ok=True)
        file.unlink()  # Remove file
        return True
    except FileNotFoundError as error:
        print(error)
        print("Check that root dir has been correctly set in config.ini")
        raise FileNotFoundError