[python] How can I check the extension of a file?