Python3 fixes

Signed-off-by: Paul Brook <paul@nowt.org>