title: Use fnmatch.filter to filter files by more than one possible file extension
body: <p>Given the following piece of python code:</p>
  
  <pre><code>for root, dirs, files in os.walk(directory):
      for filename in fnmatch.filter(files, '*.png'):
          pass
  </code></pre>
  
  <p>How can I filter for more than one extension? In this special case I want to get all files ending with *.png, *.gif, *.jpg or *.jpeg.</p>
  
  <p>For now I came up with</p>
  
  <pre><code>for root, dirs, files in os.walk(directory):
      for extension in ['jpg', 'jpeg', 'gif', 'png']:
          for filename in fnmatch.filter(files, '*.' + extension):
              pass
  </code></pre>
  
  <p>But I think it is not very elegant and performant.</p>
  
  <p>Someone has a better idea?</p>