Add support for Python 3.x

Signed-off-by: Anton D. Kachalov <mouse@yandex-team.ru>