Make it compatible with Python 2.4-2.7 and Python 3.

I've made some changes to make speedtest-cli can work with Python 3 as well.

Tested with Python 2.4-2.7 and Python 3.1-3.3.