def _decode(self, data, algorithm, key=None):
if algorithm['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>verify_signature = data[-algorithm['<STR_LIT>']:]<EOL>data = data[:-algorithm['<STR_LIT>']]<EOL>signature = self._hmac_generate(data, algorithm, key)<EOL>if not const_equal(verify_signature, signature):<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>return data<EOL><DEDENT>elif algorithm['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>return self._aes_decrypt(data, algorithm, key)<EOL><DEDENT>elif algorithm['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>return data<EOL><DEDENT>elif algorithm['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>return json.loads(data)<EOL><DEDENT>elif algorithm['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>return data<EOL><DEDENT>elif algorithm['<STR_LIT:type>'] == '<STR_LIT>':<EOL><INDENT>return self._zlib_decompress(data, algorithm)<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>' % algorithm['<STR_LIT:type>'])<EOL><DEDENT>
Decode data with specific algorithm