def _shutdown(self, manual):
if self._session_context is None:<EOL><INDENT>return<EOL><DEDENT>result = Security.SSLClose(self._session_context)<EOL>if osx_version_info < (<NUM_LIT:10>, <NUM_LIT:8>):<EOL><INDENT>result = Security.SSLDisposeContext(self._session_context)<EOL>handle_sec_error(result)<EOL><DEDENT>else:<EOL><INDENT>result = CoreFoundation.CFRelease(self._session_context)<EOL>handle_cf_error(result)<EOL><DEDENT>self._session_context = None<EOL>if manual:<EOL><INDENT>self._local_closed = True<EOL><DEDENT>try:<EOL><INDENT>self._socket.shutdown(socket_.SHUT_RDWR)<EOL><DEDENT>except (socket_.error):<EOL><INDENT>pass<EOL><DEDENT>
Shuts down the TLS session and then shuts down the underlying socket

:param manual:
    A boolean if the connection was manually shutdown