Python 3 compatibility

The current version of flask-compress has two incompatibilities with python 3:

* It uses `xrange`, which does not exist in python 3;
* It passes an `io.StringIO` object to `GzipFile`, which expects a byte-based stream.

The pull request has a few small changes to fix those problems.