Hi
Without testing or verifying:
You should probably use bytes in Python 3, not characters.
> v = ''.join(chr(random.randint(0, 0xFF)) for i in range(16))
creates a string of 16 (unicode) characters in Python 3
iv = os.urandom(16)
creates 16 bytes
Mirko