':param key: The encryption key
:param iv: init vector
:param msg: Base64 encoded message to be decrypted
:return: The decrypted message'

def decrypt(self, msg, iv=None, padding='PKCS#7', b64dec=True):

    if b64dec:
        data = b64decode(msg)
    else:
        data = msg
    _iv = data[:AES.block_size]
    if iv:
        assert (iv == _iv)
    (cipher, iv) = self.build_cipher(iv)
    res = cipher.decrypt(data)[AES.block_size:]
    if (padding in ['PKCS#5', 'PKCS#7']):
        res = res[:(- ord(res[(-1)]))]
    return res
