Python 3 fixes

I fixed the issues some small things, so it works with Python 3, while keeping it compatible with 2.6 an 2.7.

Distribute is required for 2to3 conversion.

Signed-off-by: Richard Borcsik <richard@borcsik.com>