Proper GZIP testing

Test for a GZIP'd using magic bytes.  See the [appropriate answer on Emacs.SE](http://emacs.stackexchange.com/a/2978) for details.
Is this the right function? I don't see it defined anywhere, is it built-in?