def _prepare_proxy(self, conn):
<EOL>try:<EOL><INDENT>set_tunnel = conn.set_tunnel<EOL><DEDENT>except AttributeError:  <EOL><INDENT>set_tunnel = conn._set_tunnel<EOL><DEDENT>if sys.version_info <= (<NUM_LIT:2>, <NUM_LIT:6>, <NUM_LIT:4>) and not self.proxy_headers:   <EOL><INDENT>set_tunnel(self.host, self.port)<EOL><DEDENT>else:<EOL><INDENT>set_tunnel(self.host, self.port, self.proxy_headers)<EOL><DEDENT>conn.connect()<EOL>
Establish tunnel connection early, because otherwise httplib
would improperly set Host: header to proxy's IP:port.