Add Python 3 support

BTW Python 3.1 is not supported by Pillow so I can't support it in
imgdiff.