Python 3 compatibility fixes.

Signed-off-by: Richard Borcsik <richard@borcsik.com>