I'm trying to compress a dictionary for accessing an API.  

I read the code of someone compressing the data with JavaScript and a library called "pako" and tried it myself. It works perfectly:

```
var myDictionary = {...}

var b = pako.deflate(JSON.stringify(a), { 
    to: "string", 
    gzip: !0 
  }); 
  return b = btoa(b) 
}

var compressed = b(n)

```

Now I would like to do the same with Python:
I tried the following, but the result is different and doesn't work:

```
my_dictionary = {...}
data_json = json.dumps(my_dictionary, ensure_ascii=False)
data_gzip = zlib.compress(bytes(data_json, "utf-8"))
compressed = base64.b64encode(bytes(str(data_gzip), "utf-8"))

```

Has anyone an ideal how to solve this problem with Python? Is there a similar library to pako for Python?