python 3 type checking fixes

Signed-off-by: Doug Hellmann <doug.hellmann@gmail.com>