Support python3

While still being compatible with python2.