How to check if a file is a valid image file? How to check if a file is a valid image file? python python