Hide Python 2 vs. 3 differences in gzip.GzipFile()

def _gzip_open_handle(handle):
    """"Hide Python 2 vs. 3 differences in gzip.GzipFile()"""
    import gzip
    if sys.version_info[0] > 2:
        import io
        handle = io.TextIOWrapper(gzip.GzipFile(fileobj=handle), encoding="UTF-8")
    else:
        handle = gzip.GzipFile(fileobj=handle)
    return handle