from pathlib import Path


def get_package_root() -> Path:
    """Returns package root folder."""
    conf_folder = Path(__file__).parent.parent
    dirs_in_scope = [x.name for x in conf_folder.iterdir() if x.is_dir()]

    if "mapservices" not in dirs_in_scope:
        msg = (
            f"Not the right root directory. ({conf_folder.absolute()}) "
            "Did you change the project structure?"
        )
        raise ValueError(msg)

    return conf_folder