fix proxy code for Python 3
move imports to beginning of the file
add a test for proxy detection
Merge pull request #351 from ros-infrastructure/proxy_py3

fix proxy code for Python 3