def should_include_path(path, includes=None, excludes=None, isRemotePath=False
    ):
    """Return True iff the given path should be included."""
    from os.path import basename
    from fnmatch import fnmatch, fnmatchcase
    if isRemotePath:
        fnmatch = fnmatchcase
    base = basename(path)
    if includes:
        for include in includes:
            if fnmatch(base, include):
                break
        else:
            return False
    if excludes:
        for exclude in excludes:
            if fnmatch(base, exclude):
                return False
    return True
