We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Update our SOCKS documentation
- `socks4a://` is useless, all DNS queries are resolved client-side for SOCKS4.
- `socks5://` should have a warning about DNS queries being resolved client-side and that `socks5h://` is recommended for secure use (Should have been the default on our end).
- PySocks supports IPv6 connections to the SOCKS proxy.
- Need to check all our other assumptions in those docs.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/urllib3/contrib/socks.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 """
3 This module contains provisional support for SOCKS proxies from within
4 urllib3. This module supports SOCKS4 (specifically the SOCKS4A variant) and
5 SOCKS5. To enable its functionality, either install PySocks or install this
6 module with the ``socks`` extra.
7 
8 The SOCKS implementation supports the full range of urllib3 features. It also
9 supports the following SOCKS features:
10 
11 - SOCKS4
12 - SOCKS4a
13 - SOCKS5
14 - Usernames and passwords for the SOCKS proxy
15 
16 Known Limitations:
17 
18 - Currently PySocks does not support contacting remote websites via literal
19   IPv6 addresses. Any such connection attempt will fail. You must use a domain
20   name.
21 - Currently PySocks does not support IPv6 connections to the SOCKS proxy. Any
22   such connection attempt will fail.
23 """
24 from __future__ import absolute_import
25 
26 try:
27     import socks
28 except ImportError:
29     import warnings
30     from ..exceptions import DependencyWarning
31 
32     warnings.warn((
33         'SOCKS support in urllib3 requires the installation of optional '
34         'dependencies: specifically, PySocks.  For more information, see '
35         'https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies'
36         ),
37         DependencyWarning
38     )
39     raise
40 
41 from socket import error as SocketError, timeout as SocketTimeout
42 
43 from ..connection import (
44     HTTPConnection, HTTPSConnection
45 )
46 from ..connectionpool import (
47     HTTPConnectionPool, HTTPSConnectionPool
48 )
49 from ..exceptions import ConnectTimeoutError, NewConnectionError
50 from ..poolmanager import PoolManager
51 from ..util.url import parse_url
52 
53 try:
54     import ssl
55 except ImportError:
56     ssl = None
57 
58 
59 class SOCKSConnection(HTTPConnection):
60     """
61     A plain-text HTTP connection that connects via a SOCKS proxy.
62     """
63     def __init__(self, *args, **kwargs):
64         self._socks_options = kwargs.pop('_socks_options')
65         super(SOCKSConnection, self).__init__(*args, **kwargs)
66 
67     def _new_conn(self):
68         """
69         Establish a new connection via the SOCKS proxy.
70         """
71         extra_kw = {}
72         if self.source_address:
73             extra_kw['source_address'] = self.source_address
74 
75         if self.socket_options:
76             extra_kw['socket_options'] = self.socket_options
77 
78         try:
79             conn = socks.create_connection(
80                 (self.host, self.port),
81                 proxy_type=self._socks_options['socks_version'],
82                 proxy_addr=self._socks_options['proxy_host'],
83                 proxy_port=self._socks_options['proxy_port'],
84                 proxy_username=self._socks_options['username'],
85                 proxy_password=self._socks_options['password'],
86                 proxy_rdns=self._socks_options['rdns'],
87                 timeout=self.timeout,
88                 **extra_kw
89             )
90 
91         except SocketTimeout:
92             raise ConnectTimeoutError(
93                 self, "Connection to %s timed out. (connect timeout=%s)" %
94                 (self.host, self.timeout))
95 
96         except socks.ProxyError as e:
97             # This is fragile as hell, but it seems to be the only way to raise
98             # useful errors here.
99             if e.socket_err:
100                 error = e.socket_err
101                 if isinstance(error, SocketTimeout):
102                     raise ConnectTimeoutError(
103                         self,
104                         "Connection to %s timed out. (connect timeout=%s)" %
105                         (self.host, self.timeout)
106                     )
107                 else:
108                     raise NewConnectionError(
109                         self,
110                         "Failed to establish a new connection: %s" % error
111                     )
112             else:
113                 raise NewConnectionError(
114                     self,
115                     "Failed to establish a new connection: %s" % e
116                 )
117 
118         except SocketError as e:  # Defensive: PySocks should catch all these.
119             raise NewConnectionError(
120                 self, "Failed to establish a new connection: %s" % e)
121 
122         return conn
123 
124 
125 # We don't need to duplicate the Verified/Unverified distinction from
126 # urllib3/connection.py here because the HTTPSConnection will already have been
127 # correctly set to either the Verified or Unverified form by that module. This
128 # means the SOCKSHTTPSConnection will automatically be the correct type.
129 class SOCKSHTTPSConnection(SOCKSConnection, HTTPSConnection):
130     pass
131 
132 
133 class SOCKSHTTPConnectionPool(HTTPConnectionPool):
134     ConnectionCls = SOCKSConnection
135 
136 
137 class SOCKSHTTPSConnectionPool(HTTPSConnectionPool):
138     ConnectionCls = SOCKSHTTPSConnection
139 
140 
141 class SOCKSProxyManager(PoolManager):
142     """
143     A version of the urllib3 ProxyManager that routes connections via the
144     defined SOCKS proxy.
145     """
146     pool_classes_by_scheme = {
147         'http': SOCKSHTTPConnectionPool,
148         'https': SOCKSHTTPSConnectionPool,
149     }
150 
151     def __init__(self, proxy_url, username=None, password=None,
152                  num_pools=10, headers=None, **connection_pool_kw):
153         parsed = parse_url(proxy_url)
154 
155         if username is None and password is None and parsed.auth is not None:
156             split = parsed.auth.split(':')
157             if len(split) == 2:
158                 username, password = split
159         if parsed.scheme == 'socks5':
160             socks_version = socks.PROXY_TYPE_SOCKS5
161             rdns = False
162         elif parsed.scheme == 'socks5h':
163             socks_version = socks.PROXY_TYPE_SOCKS5
164             rdns = True
165         elif parsed.scheme == 'socks4':
166             socks_version = socks.PROXY_TYPE_SOCKS4
167             rdns = False
168         elif parsed.scheme == 'socks4a':
169             socks_version = socks.PROXY_TYPE_SOCKS4
170             rdns = True
171         else:
172             raise ValueError(
173                 "Unable to determine SOCKS version from %s" % proxy_url
174             )
175 
176         self.proxy_url = proxy_url
177 
178         socks_options = {
179             'socks_version': socks_version,
180             'proxy_host': parsed.host,
181             'proxy_port': parsed.port,
182             'username': username,
183             'password': password,
184             'rdns': rdns
185         }
186         connection_pool_kw['_socks_options'] = socks_options
187 
188         super(SOCKSProxyManager, self).__init__(
189             num_pools, headers, **connection_pool_kw
190         )
191 
192         self.pool_classes_by_scheme = SOCKSProxyManager.pool_classes_by_scheme
193
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/urllib3/contrib/socks.py b/src/urllib3/contrib/socks.py
--- a/src/urllib3/contrib/socks.py
+++ b/src/urllib3/contrib/socks.py
@@ -1,25 +1,38 @@
 # -*- coding: utf-8 -*-
 """
 This module contains provisional support for SOCKS proxies from within
-urllib3. This module supports SOCKS4 (specifically the SOCKS4A variant) and
+urllib3. This module supports SOCKS4, SOCKS4A (an extension of SOCKS4), and
 SOCKS5. To enable its functionality, either install PySocks or install this
 module with the ``socks`` extra.
 
 The SOCKS implementation supports the full range of urllib3 features. It also
 supports the following SOCKS features:
 
-- SOCKS4
-- SOCKS4a
-- SOCKS5
+- SOCKS4A (``proxy_url='socks4a://...``)
+- SOCKS4 (``proxy_url='socks4://...``)
+- SOCKS5 with remote DNS (``proxy_url='socks5h://...``)
+- SOCKS5 with local DNS (``proxy_url='socks5://...``)
 - Usernames and passwords for the SOCKS proxy
 
-Known Limitations:
+ .. note::
+    It is recommended to use ``socks5h://`` or ``socks4a://`` schemes in
+    your ``proxy_url`` to ensure that DNS resolution is done from the remote
+    server instead of client-side when connecting to a domain name.
+
+SOCKS4 supports IPv4 and domain names with the SOCKS4A extension. SOCKS5
+supports IPv4, IPv6, and domain names.
+
+When connecting to a SOCKS4 proxy the ``username`` portion of the ``proxy_url``
+will be sent as the ``userid`` section of the SOCKS request::
+
+    proxy_url="socks4a://<userid>@proxy-host"
+
+When connecting to a SOCKS5 proxy the ``username`` and ``password`` portion
+of the ``proxy_url`` will be sent as the username/password to authenticate
+with the proxy::
+
+    proxy_url="socks5h://<username>:<password>@proxy-host"
 
-- Currently PySocks does not support contacting remote websites via literal
-  IPv6 addresses. Any such connection attempt will fail. You must use a domain
-  name.
-- Currently PySocks does not support IPv6 connections to the SOCKS proxy. Any
-  such connection attempt will fail.
 """
 from __future__ import absolute_import

{"golden_diff": "diff --git a/src/urllib3/contrib/socks.py b/src/urllib3/contrib/socks.py\n--- a/src/urllib3/contrib/socks.py\n+++ b/src/urllib3/contrib/socks.py\n@@ -1,25 +1,38 @@\n # -*- coding: utf-8 -*-\n \"\"\"\n This module contains provisional support for SOCKS proxies from within\n-urllib3. This module supports SOCKS4 (specifically the SOCKS4A variant) and\n+urllib3. This module supports SOCKS4, SOCKS4A (an extension of SOCKS4), and\n SOCKS5. To enable its functionality, either install PySocks or install this\n module with the ``socks`` extra.\n \n The SOCKS implementation supports the full range of urllib3 features. It also\n supports the following SOCKS features:\n \n-- SOCKS4\n-- SOCKS4a\n-- SOCKS5\n+- SOCKS4A (``proxy_url='socks4a://...``)\n+- SOCKS4 (``proxy_url='socks4://...``)\n+- SOCKS5 with remote DNS (``proxy_url='socks5h://...``)\n+- SOCKS5 with local DNS (``proxy_url='socks5://...``)\n - Usernames and passwords for the SOCKS proxy\n \n-Known Limitations:\n+ .. note::\n+    It is recommended to use ``socks5h://`` or ``socks4a://`` schemes in\n+    your ``proxy_url`` to ensure that DNS resolution is done from the remote\n+    server instead of client-side when connecting to a domain name.\n+\n+SOCKS4 supports IPv4 and domain names with the SOCKS4A extension. SOCKS5\n+supports IPv4, IPv6, and domain names.\n+\n+When connecting to a SOCKS4 proxy the ``username`` portion of the ``proxy_url``\n+will be sent as the ``userid`` section of the SOCKS request::\n+\n+    proxy_url=\"socks4a://<userid>@proxy-host\"\n+\n+When connecting to a SOCKS5 proxy the ``username`` and ``password`` portion\n+of the ``proxy_url`` will be sent as the username/password to authenticate\n+with the proxy::\n+\n+    proxy_url=\"socks5h://<username>:<password>@proxy-host\"\n \n-- Currently PySocks does not support contacting remote websites via literal\n-  IPv6 addresses. Any such connection attempt will fail. You must use a domain\n-  name.\n-- Currently PySocks does not support IPv6 connections to the SOCKS proxy. Any\n-  such connection attempt will fail.\n \"\"\"\n from __future__ import absolute_import\n", "issue": "Update our SOCKS documentation\n- `socks4a://` is useless, all DNS queries are resolved client-side for SOCKS4.\r\n- `socks5://` should have a warning about DNS queries being resolved client-side and that `socks5h://` is recommended for secure use (Should have been the default on our end).\r\n- PySocks supports IPv6 connections to the SOCKS proxy.\r\n- Need to check all our other assumptions in those docs.\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nThis module contains provisional support for SOCKS proxies from within\nurllib3. This module supports SOCKS4 (specifically the SOCKS4A variant) and\nSOCKS5. To enable its functionality, either install PySocks or install this\nmodule with the ``socks`` extra.\n\nThe SOCKS implementation supports the full range of urllib3 features. It also\nsupports the following SOCKS features:\n\n- SOCKS4\n- SOCKS4a\n- SOCKS5\n- Usernames and passwords for the SOCKS proxy\n\nKnown Limitations:\n\n- Currently PySocks does not support contacting remote websites via literal\n  IPv6 addresses. Any such connection attempt will fail. You must use a domain\n  name.\n- Currently PySocks does not support IPv6 connections to the SOCKS proxy. Any\n  such connection attempt will fail.\n\"\"\"\nfrom __future__ import absolute_import\n\ntry:\n    import socks\nexcept ImportError:\n    import warnings\n    from ..exceptions import DependencyWarning\n\n    warnings.warn((\n        'SOCKS support in urllib3 requires the installation of optional '\n        'dependencies: specifically, PySocks.  For more information, see '\n        'https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies'\n        ),\n        DependencyWarning\n    )\n    raise\n\nfrom socket import error as SocketError, timeout as SocketTimeout\n\nfrom ..connection import (\n    HTTPConnection, HTTPSConnection\n)\nfrom ..connectionpool import (\n    HTTPConnectionPool, HTTPSConnectionPool\n)\nfrom ..exceptions import ConnectTimeoutError, NewConnectionError\nfrom ..poolmanager import PoolManager\nfrom ..util.url import parse_url\n\ntry:\n    import ssl\nexcept ImportError:\n    ssl = None\n\n\nclass SOCKSConnection(HTTPConnection):\n    \"\"\"\n    A plain-text HTTP connection that connects via a SOCKS proxy.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        self._socks_options = kwargs.pop('_socks_options')\n        super(SOCKSConnection, self).__init__(*args, **kwargs)\n\n    def _new_conn(self):\n        \"\"\"\n        Establish a new connection via the SOCKS proxy.\n        \"\"\"\n        extra_kw = {}\n        if self.source_address:\n            extra_kw['source_address'] = self.source_address\n\n        if self.socket_options:\n            extra_kw['socket_options'] = self.socket_options\n\n        try:\n            conn = socks.create_connection(\n                (self.host, self.port),\n                proxy_type=self._socks_options['socks_version'],\n                proxy_addr=self._socks_options['proxy_host'],\n                proxy_port=self._socks_options['proxy_port'],\n                proxy_username=self._socks_options['username'],\n                proxy_password=self._socks_options['password'],\n                proxy_rdns=self._socks_options['rdns'],\n                timeout=self.timeout,\n                **extra_kw\n            )\n\n        except SocketTimeout:\n            raise ConnectTimeoutError(\n                self, \"Connection to %s timed out. (connect timeout=%s)\" %\n                (self.host, self.timeout))\n\n        except socks.ProxyError as e:\n            # This is fragile as hell, but it seems to be the only way to raise\n            # useful errors here.\n            if e.socket_err:\n                error = e.socket_err\n                if isinstance(error, SocketTimeout):\n                    raise ConnectTimeoutError(\n                        self,\n                        \"Connection to %s timed out. (connect timeout=%s)\" %\n                        (self.host, self.timeout)\n                    )\n                else:\n                    raise NewConnectionError(\n                        self,\n                        \"Failed to establish a new connection: %s\" % error\n                    )\n            else:\n                raise NewConnectionError(\n                    self,\n                    \"Failed to establish a new connection: %s\" % e\n                )\n\n        except SocketError as e:  # Defensive: PySocks should catch all these.\n            raise NewConnectionError(\n                self, \"Failed to establish a new connection: %s\" % e)\n\n        return conn\n\n\n# We don't need to duplicate the Verified/Unverified distinction from\n# urllib3/connection.py here because the HTTPSConnection will already have been\n# correctly set to either the Verified or Unverified form by that module. This\n# means the SOCKSHTTPSConnection will automatically be the correct type.\nclass SOCKSHTTPSConnection(SOCKSConnection, HTTPSConnection):\n    pass\n\n\nclass SOCKSHTTPConnectionPool(HTTPConnectionPool):\n    ConnectionCls = SOCKSConnection\n\n\nclass SOCKSHTTPSConnectionPool(HTTPSConnectionPool):\n    ConnectionCls = SOCKSHTTPSConnection\n\n\nclass SOCKSProxyManager(PoolManager):\n    \"\"\"\n    A version of the urllib3 ProxyManager that routes connections via the\n    defined SOCKS proxy.\n    \"\"\"\n    pool_classes_by_scheme = {\n        'http': SOCKSHTTPConnectionPool,\n        'https': SOCKSHTTPSConnectionPool,\n    }\n\n    def __init__(self, proxy_url, username=None, password=None,\n                 num_pools=10, headers=None, **connection_pool_kw):\n        parsed = parse_url(proxy_url)\n\n        if username is None and password is None and parsed.auth is not None:\n            split = parsed.auth.split(':')\n            if len(split) == 2:\n                username, password = split\n        if parsed.scheme == 'socks5':\n            socks_version = socks.PROXY_TYPE_SOCKS5\n            rdns = False\n        elif parsed.scheme == 'socks5h':\n            socks_version = socks.PROXY_TYPE_SOCKS5\n            rdns = True\n        elif parsed.scheme == 'socks4':\n            socks_version = socks.PROXY_TYPE_SOCKS4\n            rdns = False\n        elif parsed.scheme == 'socks4a':\n            socks_version = socks.PROXY_TYPE_SOCKS4\n            rdns = True\n        else:\n            raise ValueError(\n                \"Unable to determine SOCKS version from %s\" % proxy_url\n            )\n\n        self.proxy_url = proxy_url\n\n        socks_options = {\n            'socks_version': socks_version,\n            'proxy_host': parsed.host,\n            'proxy_port': parsed.port,\n            'username': username,\n            'password': password,\n            'rdns': rdns\n        }\n        connection_pool_kw['_socks_options'] = socks_options\n\n        super(SOCKSProxyManager, self).__init__(\n            num_pools, headers, **connection_pool_kw\n        )\n\n        self.pool_classes_by_scheme = SOCKSProxyManager.pool_classes_by_scheme\n", "path": "src/urllib3/contrib/socks.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nThis module contains provisional support for SOCKS proxies from within\nurllib3. This module supports SOCKS4, SOCKS4A (an extension of SOCKS4), and\nSOCKS5. To enable its functionality, either install PySocks or install this\nmodule with the ``socks`` extra.\n\nThe SOCKS implementation supports the full range of urllib3 features. It also\nsupports the following SOCKS features:\n\n- SOCKS4A (``proxy_url='socks4a://...``)\n- SOCKS4 (``proxy_url='socks4://...``)\n- SOCKS5 with remote DNS (``proxy_url='socks5h://...``)\n- SOCKS5 with local DNS (``proxy_url='socks5://...``)\n- Usernames and passwords for the SOCKS proxy\n\n .. note::\n    It is recommended to use ``socks5h://`` or ``socks4a://`` schemes in\n    your ``proxy_url`` to ensure that DNS resolution is done from the remote\n    server instead of client-side when connecting to a domain name.\n\nSOCKS4 supports IPv4 and domain names with the SOCKS4A extension. SOCKS5\nsupports IPv4, IPv6, and domain names.\n\nWhen connecting to a SOCKS4 proxy the ``username`` portion of the ``proxy_url``\nwill be sent as the ``userid`` section of the SOCKS request::\n\n    proxy_url=\"socks4a://<userid>@proxy-host\"\n\nWhen connecting to a SOCKS5 proxy the ``username`` and ``password`` portion\nof the ``proxy_url`` will be sent as the username/password to authenticate\nwith the proxy::\n\n    proxy_url=\"socks5h://<username>:<password>@proxy-host\"\n\n\"\"\"\nfrom __future__ import absolute_import\n\ntry:\n    import socks\nexcept ImportError:\n    import warnings\n    from ..exceptions import DependencyWarning\n\n    warnings.warn((\n        'SOCKS support in urllib3 requires the installation of optional '\n        'dependencies: specifically, PySocks.  For more information, see '\n        'https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies'\n        ),\n        DependencyWarning\n    )\n    raise\n\nfrom socket import error as SocketError, timeout as SocketTimeout\n\nfrom ..connection import (\n    HTTPConnection, HTTPSConnection\n)\nfrom ..connectionpool import (\n    HTTPConnectionPool, HTTPSConnectionPool\n)\nfrom ..exceptions import ConnectTimeoutError, NewConnectionError\nfrom ..poolmanager import PoolManager\nfrom ..util.url import parse_url\n\ntry:\n    import ssl\nexcept ImportError:\n    ssl = None\n\n\nclass SOCKSConnection(HTTPConnection):\n    \"\"\"\n    A plain-text HTTP connection that connects via a SOCKS proxy.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        self._socks_options = kwargs.pop('_socks_options')\n        super(SOCKSConnection, self).__init__(*args, **kwargs)\n\n    def _new_conn(self):\n        \"\"\"\n        Establish a new connection via the SOCKS proxy.\n        \"\"\"\n        extra_kw = {}\n        if self.source_address:\n            extra_kw['source_address'] = self.source_address\n\n        if self.socket_options:\n            extra_kw['socket_options'] = self.socket_options\n\n        try:\n            conn = socks.create_connection(\n                (self.host, self.port),\n                proxy_type=self._socks_options['socks_version'],\n                proxy_addr=self._socks_options['proxy_host'],\n                proxy_port=self._socks_options['proxy_port'],\n                proxy_username=self._socks_options['username'],\n                proxy_password=self._socks_options['password'],\n                proxy_rdns=self._socks_options['rdns'],\n                timeout=self.timeout,\n                **extra_kw\n            )\n\n        except SocketTimeout:\n            raise ConnectTimeoutError(\n                self, \"Connection to %s timed out. (connect timeout=%s)\" %\n                (self.host, self.timeout))\n\n        except socks.ProxyError as e:\n            # This is fragile as hell, but it seems to be the only way to raise\n            # useful errors here.\n            if e.socket_err:\n                error = e.socket_err\n                if isinstance(error, SocketTimeout):\n                    raise ConnectTimeoutError(\n                        self,\n                        \"Connection to %s timed out. (connect timeout=%s)\" %\n                        (self.host, self.timeout)\n                    )\n                else:\n                    raise NewConnectionError(\n                        self,\n                        \"Failed to establish a new connection: %s\" % error\n                    )\n            else:\n                raise NewConnectionError(\n                    self,\n                    \"Failed to establish a new connection: %s\" % e\n                )\n\n        except SocketError as e:  # Defensive: PySocks should catch all these.\n            raise NewConnectionError(\n                self, \"Failed to establish a new connection: %s\" % e)\n\n        return conn\n\n\n# We don't need to duplicate the Verified/Unverified distinction from\n# urllib3/connection.py here because the HTTPSConnection will already have been\n# correctly set to either the Verified or Unverified form by that module. This\n# means the SOCKSHTTPSConnection will automatically be the correct type.\nclass SOCKSHTTPSConnection(SOCKSConnection, HTTPSConnection):\n    pass\n\n\nclass SOCKSHTTPConnectionPool(HTTPConnectionPool):\n    ConnectionCls = SOCKSConnection\n\n\nclass SOCKSHTTPSConnectionPool(HTTPSConnectionPool):\n    ConnectionCls = SOCKSHTTPSConnection\n\n\nclass SOCKSProxyManager(PoolManager):\n    \"\"\"\n    A version of the urllib3 ProxyManager that routes connections via the\n    defined SOCKS proxy.\n    \"\"\"\n    pool_classes_by_scheme = {\n        'http': SOCKSHTTPConnectionPool,\n        'https': SOCKSHTTPSConnectionPool,\n    }\n\n    def __init__(self, proxy_url, username=None, password=None,\n                 num_pools=10, headers=None, **connection_pool_kw):\n        parsed = parse_url(proxy_url)\n\n        if username is None and password is None and parsed.auth is not None:\n            split = parsed.auth.split(':')\n            if len(split) == 2:\n                username, password = split\n        if parsed.scheme == 'socks5':\n            socks_version = socks.PROXY_TYPE_SOCKS5\n            rdns = False\n        elif parsed.scheme == 'socks5h':\n            socks_version = socks.PROXY_TYPE_SOCKS5\n            rdns = True\n        elif parsed.scheme == 'socks4':\n            socks_version = socks.PROXY_TYPE_SOCKS4\n            rdns = False\n        elif parsed.scheme == 'socks4a':\n            socks_version = socks.PROXY_TYPE_SOCKS4\n            rdns = True\n        else:\n            raise ValueError(\n                \"Unable to determine SOCKS version from %s\" % proxy_url\n            )\n\n        self.proxy_url = proxy_url\n\n        socks_options = {\n            'socks_version': socks_version,\n            'proxy_host': parsed.host,\n            'proxy_port': parsed.port,\n            'username': username,\n            'password': password,\n            'rdns': rdns\n        }\n        connection_pool_kw['_socks_options'] = socks_options\n\n        super(SOCKSProxyManager, self).__init__(\n            num_pools, headers, **connection_pool_kw\n        )\n\n        self.pool_classes_by_scheme = SOCKSProxyManager.pool_classes_by_scheme\n", "path": "src/urllib3/contrib/socks.py"}]}