def fnmatchcase(filename, pattern): cached_pattern = _get_cached_pattern(pattern) return cached_pattern.match(filename) is not None