plaintext = data.encode('utf-8')
l = len(plaintext)
ciphertext = cipher.encrypt(plaintext + (16 - len % 16) * PADDING_BYTE)
How to add a padding to the data to make it acceptable for AES256 encryption algorithm in pycrypto library