some more work using six for python3 compatibility