Fix Python 3 and remove Python 2 support.