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