``has_key`` has been deprecated in Python3, use simple ``in`` instead.

Found by 2to3 and python -3.
IIRC Python 3 insists that keys and values to os.environ are bytes, not str. I suspect you'll run into an issue with this later. Not worth dealing with now, however.