Retrieve environment proxies using standard library functions

I ran into a problem earlier today when trying to debug an issue with migrating some code from urllib2 to requests. To compare the requests being made, I fired up my trusty web debugging proxy (Charles), but the requests from requests (ahem) weren't being sent through the proxy.

After digging around in the code, I noticed that requests was only checking the OS environment variables for proxy settings, not the extra OS-specific locations handled by urllib2's ProxyHandler (the System Configuration framework on OS X and the Windows registry). Since the requests code appeared to be duplicating some functionality already in urllib, I made a quick patch to use the standard library functions instead.

It works as expected on Python 2 and 3 using OS X; since it's using urllib under the hood I assume it's safe, but I'll test on Windows/Linux when I'm having less of a nightmare day. However, I'm unsure how to write a test that covers this, since it depends on the current environment's configuration. Any advice would be appreciated!