from pathlib import Path
from typing import Sequence


def _structure_exists(base_dir: Path, paths: Sequence[str]) -> bool:
    """
    Helper function for match_structure to check if
    all subpaths exist at some base directory

    For example:

    dir1
    ├── index.json
    └── messages
        └── messages.csv

    _structure_exists(Path("dir1"), ["index.json", "messages/messages.csv"])
    """
    for p in paths:
        target: Path = base_dir / p
        if not target.exists():
            return False
    return True