title: Python3 error: initial_value must be str or None, with StringIO
body: <p>While porting code from <code>python2</code> to <code>3</code>, I get this error when reading from a URL </p>
  
  <blockquote>
    <p>TypeError: initial_value must be str or None, not bytes.</p>
  </blockquote>
  
  <pre><code>import urllib
  import json
  import gzip
  from urllib.parse import urlencode
  from urllib.request import Request
  
  
  service_url = 'https://babelfy.io/v1/disambiguate'
  text = 'BabelNet is both a multilingual encyclopedic dictionary and a semantic network'
  lang = 'EN'
  Key  = 'KEY'
  
      params = {
          'text' : text,
          'key'  : Key,
          'lang' :'EN'
  
          }
  
  url = service_url + '?' + urllib.urlencode(params)
  request = Request(url)
  request.add_header('Accept-encoding', 'gzip')
  response = urllib.request.urlopen(request)
  if response.info().get('Content-Encoding') == 'gzip':
              buf = StringIO(response.read())
              f = gzip.GzipFile(fileobj=buf)
              data = json.loads(f.read())
  </code></pre>
  
  <p>The exception is thrown at this line  </p>
  
  <pre><code>buf = StringIO(response.read())  
  </code></pre>
  
  <p>If I use python2, it works fine.</p>