Add Python 3 support

Rewrite print() call to support Python 3 syntax.

Don't import exceptions for Python 3.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
declare encoding
Merge branch 'p2to3' of github.com:yegorich/tools