You can use `fname.endswith('.h5')` instead. Also, you should put those continue statements on a separate line.