This 'try: ... except:' seems contorted, given that we know whether it is gzipped just five lines above.  Maybe dispatch up there to two separate inner functions returning (size, checksum)?