Some basic py 3 compatibility

Signed-off-by: Michal Čihař <michal@cihar.com>