urllib2 compat for python3.
urllib2 compat for python3.
Python 3 compatible exception handling.