from pathlib import Path


def check_parents(p: Path, depth: int, names: list) -> bool:
    """Check path to make sure parents aren't top level folders

    Parameters
    ----------
    p : Path
        Path to check\n
    depth : int
        From start of folder path to this folder level\n
    names : list
        Names to check

    Returns
    -------
    bool
        If path checked is top level folder
    """
    names = [n.lower() for n in names]

    for parent in list(p.parents)[:depth]:
        if parent.name.lower() in names:
            return True

    return False