def _gzip_open_filename(handle):
    """Hide Python 2 vs. 3 differences in gzip.open()"""
    import gzip
    if sys.version_info[0] > 2:
        handle = gzip.open(handle, mode='rt', encoding="UTF-8")
    else:
        handle = gzip.open(handle)
    return handle
Hide Python 2 vs. 3 differences in gzip.open()