title: Decompress gz compressed string using Python3.6
body: <p>I want to decompress the following gz compressed string using python3.6:</p>
  
  <pre><code>H4sIAAAAAAAA//NIzcnJVwjPL8pJAQBWsRdKCwAAAA==
  </code></pre>
  
  <p>The decompressed string is "<em>Hello World</em>"</p>
  
  <p>I was able to decompress it using online tool - <a href="http://www.txtwizard.net/compression" rel="nofollow noreferrer">http://www.txtwizard.net/compression</a> but I couldn't find a proper way to do it in python. </p>
  
  <p>I tried zlib and gzip, but they require <strong>bytes</strong> not <strong>str</strong>. I also tried converting it using <em>io.Bytes()</em> but of no use. My Code is:</p>
  
  <pre><code>import gzip
  import io 
  
  class SearchEvents:
  
  def decompressPayload():
      payload = "H4sIAAAAAAAA//NIzcnJVwjPL8pJAQBWsRdKCwAAAA=="
      payload_bytes = io.BytesIO(payload)
      print(gzip.decompress(payload_bytes))
  
  SearchEvents.decompressPayload()
  </code></pre>
  
  <p>I am expecting "<em>Hello World</em>" as output. But I am getting the following error:</p>
  
  <pre><code>Traceback (most recent call last):
  File "SearchEvents.py", line 13, in &lt;module&gt;
  SearchEvents.decompressPayload()
  File "SearchEvents.py", line 10, in decompressPayload
  payload_bytes = io.BytesIO(payload)
  TypeError: a bytes-like object is required, not 'str'
  </code></pre>
  
  <p>Is there any way to achieve what I want?</p>