def make_excluded(excludes=None): if excludes is None: return DEFAULT_EXCLUDES_RE patterns = [DEFAULT_EXCLUDES] patterns.extend(fnmatch.translated(x) for x in excludes) return re.compile("|".join(patterns)).match