def _check_ancestors(path, match, ancestors):
    """
    Require N ancestors to be in common with original path and matched path
    """
    pl = path.lower()
    ml = match.lower()
    if pl == ml:
        return True
    if len(ml.split('/')) < len(pl.split('/')) and pl.endswith(ml):
        return True
    return ml.endswith('/'.join(pl.split('/')[(ancestors + 1) * -1:]))
