has_valid_extension(filename, extensions) that returns True if filename ends with one of the extensions in the list extensions (each like .jpg), matching case-insensitively.filename = 'photo.JPG', extensions = ['.jpg', '.png']
True
'.JPG' matches '.jpg' case-insensitively.
filename = 'notes.txt', extensions = ['.jpg', '.png']
False
No extension in the list matches.
Lowercase both the filename and the extension list before comparing.
`str.endswith()` accepts a tuple of suffixes.