def deserialize(message, b64_encoded=True, uri_encoded=True):
    """Converts an encoded message (string or bytes) into a python dictionary

    :param message: Serialized message
    :param b64_encoded: Whether the message was compressed using Gzip and encoded into Base64
    :param uri_encoded: Whether string should be decoded twice. Should be true is data was produced by this package
           and sent over the web.
    :return: Python dictionary with parsed parameters

    >>> from jsonuri import jsonuri
    >>> ser = 'H4sIAOdnb1oC%2F6tWSkxPVbJSMDbUUVDKS8wFsZW88jPylID8xOTk%2FNK8EqBQtVJmCpAyNDIHChelpmfm5xUD%2BdFKocEghcHuSrG1tQCN2YKETAAAAA%3D%3D'
    >>> jsonuri.deserialize(ser)
    >>> {'age': 31, 'name': 'John', 'account': {'id': 127, 'regions': ['US', 'SG']}}

    """

    data = message

    if uri_encoded:
        data = urllib.parse.unquote_plus(data)

    if b64_encoded:
        data = jsonuri.io.decompress(data)

    return json.loads(data)