def ssl_wrap_socket(sock, keyfile=None, certfile=None, cert_reqs=None,<EOL>ca_certs=None, server_hostname=None,<EOL>ssl_version=None, ciphers=None, ssl_context=None):
context = ssl_context<EOL>if context is None:<EOL><INDENT>context = create_urllib3_context(ssl_version, cert_reqs,<EOL>ciphers=ciphers)<EOL><DEDENT>if ca_certs:<EOL><INDENT>try:<EOL><INDENT>context.load_verify_locations(ca_certs)<EOL><DEDENT>except IOError as e:  <EOL><INDENT>raise SSLError(e)<EOL><DEDENT>except OSError as e:  <EOL><INDENT>if e.errno == errno.ENOENT:<EOL><INDENT>raise SSLError(e)<EOL><DEDENT>raise<EOL><DEDENT><DEDENT>if certfile:<EOL><INDENT>context.load_cert_chain(certfile, keyfile)<EOL><DEDENT>if HAS_SNI:  <EOL><INDENT>return context.wrap_socket(sock, server_hostname=server_hostname)<EOL><DEDENT>return context.wrap_socket(sock)<EOL>
All arguments except for server_hostname and ssl_context have the same
meaning as they do when using :func:`ssl.wrap_socket`.

:param server_hostname:
    When SNI is supported, the expected hostname of the certificate
:param ssl_context:
    A pre-made :class:`SSLContext` object. If none is provided, one will
    be created using :func:`create_urllib3_context`.
:param ciphers:
    A string of ciphers we wish the client to support. This is not
    supported on Python 2.6 as the ssl module does not support it.