title: Detecting if a file is an image in Python
body: <p>Is there any general way to detect if a file is a image (jpg, bmp, png, etc...)</p>
  
  <p>Or is making a list of the file extensions and doing a one-by-one comparison the only way?</p>