update for py3k

Fixed the following syntax issues across repo:
- print statement -> print function
- import StringIO -> import io.StringIO
- StandardError -> Exception
- exception <Exception> as ...
- urlparse -> urllib.parse.urlparse
- httplib.HTTPConnection -> http.client.HTTPConnection