from pathlib import Path


def path_to_example(dataset):
    """
    Construct a file path to an example dataset, assuming the dataset is
    contained in the 'example-data' directory of the abc-classroom package.
    Adapted from the PySAL package.

    Parameters
    ----------
    dataset: string
        Name of a dataset to access (e.g., "config.yml")

    Returns
    -------
    Path object
        A concrete Path object to the dataset
    """
    abcclassroom_path = Path(__file__).parent
    dataset_path = Path(abcclassroom_path, "example-data", dataset)
    if not dataset_path.exists():
        raise FileNotFoundError(dataset_path)
    return dataset_path