import fnmatch


def _fileMatchesPatterns(filename, patterns):
    """Helper function which checks if file matches one of the patterns."""
    for pattern in patterns:
        if fnmatch.fnmatchcase(filename, pattern):
            return True
    return False