def _ssl_do_handshake(self):
        """
        Perform an asynchronous SSL handshake.
        """
        try:
            self._socket.do_handshake()
        except ssl.SSLError as err:
            if err.args[0] == ssl.SSL_ERROR_WANT_READ:
                return 0
            elif err.args[0] == ssl.SSL_ERROR_WANT_WRITE:
                self._start_waiting_for_write_event()
                return 0
            elif err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN):
                self.close(flush=False)
                return 0
            elif err.args[0] == ssl.SSL_ERROR_SSL:
                self._safely_call(self.on_ssl_handshake_error, err)
                return 0
            else:
                raise
        except socket.error as err:
            if (errno.ECONNRESET, errno.EPIPE) in err.args[0]:
                self.close(flush=False)
                return 0
            else:
                raise
        else:
            self._ssl_handshake_done = True
            self._safely_call(self.on_ssl_handshake)
            if self._ssl_call_on_connect:
                self._safely_call(self.on_connect)
            return None


###############################################################################
# Exceptions
###############################################################################
dataset/ETHPy150Open ecdavis/pants/pants/stream.py/Stream._ssl_do_handshake/swapped operands of `in`