def _accept(self):  # noqa
        # XXX: C901: This has a high McCacbe complexity score of 10.
        # TODO: Refactor this!

        def on_done(sock, host):
            sock.setblocking(False)
            self._poller.addReader(self, sock)
            self._clients.append(sock)
            self.fire(connect(sock, *host))

        def on_error(sock, err):
            self.fire(error(sock, err))
            self._close(sock)

        try:
            newsock, host = self._sock.accept()
        except SocketError as e:
            if (EWOULDBLOCK, EAGAIN) in e.args[0]:
                return
            elif e.args[0] == EPERM:
                # Netfilter on Linux may have rejected the
                # connection, but we get told to try to accept()
                # anyway.
                return
            elif e.args[0] in (EMFILE, ENOBUFS, ENFILE, ENOMEM, ECONNABORTED):
                # Linux gives EMFILE when a process is not allowed
                # to allocate any more file descriptors.  *BSD and
                # Win32 give (WSA)ENOBUFS.  Linux can also give
                # ENFILE if the system is out of inodes, or ENOMEM
                # if there is insufficient memory to allocate a new
                # dentry.  ECONNABORTED is documented as possible on
                # both Linux and Windows, but it is not clear
                # whether there are actually any circumstances under
                # which it can happen (one might expect it to be
                # possible if a client sends a FIN or RST after the
                # server sends a SYN|ACK but before application code
                # calls accept(2), however at least on Linux this
                # _seems_ to be short-circuited by syncookies.
                return
            else:
                raise

        if self.secure and HAS_SSL:
            sslsock = ssl_socket(
                newsock,
                server_side=True,
                keyfile=self.keyfile,
                ca_certs=self.ca_certs,
                certfile=self.certfile,
                cert_reqs=self.cert_reqs,
                ssl_version=self.ssl_version,
                do_handshake_on_connect=False
            )

            for _ in do_handshake(sslsock, on_done, on_error, extra_args=(host,)):
                yield
        else:
            on_done(newsock, host)
dataset/ETHPy150Open circuits/circuits/circuits/net/sockets.py/Server._accept/swapped operands of `in`