'ValueError: IV must be 16 bytes long

I am trying to make a program to decrypt via python. The cipher used is AES-CBC. But I get this error and I don't know how to fix it. Do you have any ideas? Thanks in advance

#!/usr/bin/env python3


import base64
import binascii
from Crypto.Cipher import AES

key        = "YELLOW SUBMARINE"
iv_dec     = "a5f6ba42255643907a5bb3709840ca5b"

block_size = 16
pad_char   = u"\00"
pad = lambda s: s + (block_size - len(s) % block_size) * pad_char
ciphertext = "412053617563657266756c206f662053656372657473"

# Decrypt
aes_dec    = AES.new(str(key), AES.MODE_CBC, str(iv_dec))
decrypted = aes_dec.decrypt(ciphertext)
print ("Decrypted text: {} ".format(decrypted.rstrip(pad_char)))


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source