def detect_gzip(contents):
 return (contents[:2] == '\x1f\x8b')

def detect_gzip ( contents ) : return ( contents [ : 2 ] == '\x1f\x8b' )
this is a silly small function which checks to see if the file is gzip .