def _match_path(path, included_patterns, excluded_patterns, case_sensitive):
    """Internal function same as :func:`match_path` but does not check arguments."""
    if case_sensitive:
        path = PurePosixPath(path)
    else:
        included_patterns = {pattern.lower() for pattern in included_patterns}
        excluded_patterns = {pattern.lower() for pattern in excluded_patterns}
        path = PureWindowsPath(path)

    common_patterns = included_patterns & excluded_patterns
    if common_patterns:
        raise ValueError("conflicting patterns `{}` included and excluded".format(common_patterns))
    return any(path.match(p) for p in included_patterns) and not any(path.match(p) for p in excluded_patterns)
Internal function same as :func:`match_path` but does not check arguments.
src/watchdog/utils/patterns.py