def decode_memo(priv, pub, nonce, message):
shared_secret = get_shared_secret(priv, pub)<EOL>aes = init_aes(shared_secret, nonce)<EOL>"<STR_LIT>"<EOL>raw = bytes(message, "<STR_LIT:ascii>")<EOL>cleartext = aes.decrypt(unhexlify(raw))<EOL>"<STR_LIT>"<EOL>checksum = cleartext[<NUM_LIT:0>:<NUM_LIT:4>]<EOL>message = cleartext[<NUM_LIT:4>:]<EOL>message = _unpad(message, <NUM_LIT:16>)<EOL>"<STR_LIT>"<EOL>check = hashlib.sha256(message).digest()[<NUM_LIT:0>:<NUM_LIT:4>]<EOL>if check != checksum:  <EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>return message.decode("<STR_LIT:utf8>")<EOL>
Decode a message with a shared secret between Alice and Bob

        :param PrivateKey priv: Private Key (of Bob)
        :param PublicKey pub: Public Key (of Alice)
        :param int nonce: Nonce used for Encryption
        :param bytes message: Encrypted Memo message
        :return: Decrypted message
        :rtype: str
        :raise ValueError: if message cannot be decoded as valid UTF-8
               string