def has_file_allowed_extension(filename, extensions):
    """Checks if a file is an allowed extension.

    Args:
        filename (string): path to a file
    Returns:
        bool: True if the filename ends with a known image extension
    """
    filename_lower = filename.lower()
    return any(filename_lower.endswith(ext) for ext in extensions)
Checks if a file is an allowed extension.

    Args:
        filename (string): path to a file
    Returns:
        bool: True if the filename ends with a known image extension
    
classification/dataset/cached_image_folder.py