def performcore(self, command, dometaonly=False, designated=False):
        """The core function that performs a given command in a slot number. It
        executes regular commands as well as META-level commands (commands related
        to the managements of the Paxos protocol) with a delay of WINDOW commands."""
        commandtuple = command.command
        if type(commandtuple) == str:
            commandname = commandtuple
            commandargs = []
        else:
            commandname = commandtuple[0]
            commandargs = commandtuple[1:]
        ismeta = (commandname in METACOMMANDS)
        noop = (commandname == "noop")
        send_result_to_client = True
        if self.debug: self.logger.write("State:", "---> Command: %s DoMetaOnly: %s IsMeta: %s"
                          % (command, dometaonly, ismeta))
        # Result triple
        clientreplycode, givenresult, unblocked = (-1, None, {})
        try:
            if dometaonly and not ismeta:
                return
            elif noop:
                method = getattr(self, NOOP)
                clientreplycode = CR_OK
                givenresult = "NOOP"
                unblocked = {}
                send_result_to_client = False
            elif dometaonly and ismeta:
                # execute a metacommand when the window has expired
                if self.debug: self.logger.write("State",
                                                 "commandname: %s args: %s" %
                                                 (commandname, str(commandargs)))
                method = getattr(self, commandname)
                clientreplycode = CR_META
                givenresult = self._apply_args_to_method(method, commandargs, command)
                unblocked = {}
                send_result_to_client = False
            elif not dometaonly and ismeta:
                # meta command, but the window has not passed yet,
                # so just mark it as executed without actually executing it
                # the real execution will take place when the window has expired
                self.add_to_executed(command, (CR_META, META, {}))
                return
            elif not dometaonly and not ismeta:
                # this is the workhorse case that executes most normal commands
                method = getattr(self.object, commandname)
                # Watch out for the lock release and acquire!
                self.lock.release()
                try:
                    givenresult = self._apply_args_to_method(method, commandargs, command)
                    clientreplycode = CR_OK
                    send_result_to_client = True
                except BlockingReturn as blockingretexp:
                    if self.debug: self.logger.write("State", "Blocking Client.")
                    givenresult = blockingretexp.returnvalue
                    clientreplycode = CR_BLOCK
                    send_result_to_client = True
                except UnblockingReturn as unblockingretexp:
                    if self.debug: self.logger.write("State", "Unblocking Client(s).")
                    # Get the information about the method call
                    # These will be used to update executed and
                    # to send reply message to the caller client
                    givenresult = unblockingretexp.returnvalue
                    unblocked = unblockingretexp.unblocked
                    clientreplycode = CR_OK
                    send_result_to_client = True
                    # If there are clients to be unblocked that have
                    # been blocked previously, send them unblock messages
                    for unblockedclientcommand in unblocked.iterkeys():
                        self.send_reply_to_client(CR_UNBLOCK, None, unblockedclientcommand)
                except Exception as e:
                    if self.debug: self.logger.write("Execution Error",
                                                     "Error during method invocation: %s" % str(e))
                    givenresult = pickle.dumps(e)
                    clientreplycode = CR_EXCEPTION
                    send_result_to_client = True
                    unblocked = {}
                self.lock.acquire()
        except (TypeError, AttributeError) as t:
            if self.debug: self.logger.write("Execution Error",
                                             "command not supported: %s" % str(command))
            if self.debug: self.logger.write("Execution Error", "%s" % str(t))

            self.logger.write("Execution Error",
                              "command not supported: %s" % str(command))
            self.logger.write("Execution Error", "%s" % str(t))

            givenresult = 'Method Does Not Exist: ', commandname
            clientreplycode = CR_EXCEPTION
            unblocked = {}
            send_result_to_client = True
        self.add_to_executed(command, (clientreplycode,givenresult,unblocked))

        if METACOMMANDS not in commandname:
            # if this client contacted me for this operation, return him the response
            if send_result_to_client and self.isleader and \
                    str(command.client) in self.connectionpool.poolbypeer.keys():
                self.send_reply_to_client(clientreplycode, givenresult, command)

        if self.nexttoexecute % GARBAGEPERIOD == 0 and self.isleader:
            mynumber = self.metacommandnumber
            self.metacommandnumber += 1
            garbagetuple = ("_garbage_collect", self.nexttoexecute, self.ballotnumber)
            garbagecommand = Proposal(self.me, mynumber, garbagetuple)
            if self.leader_initializing:
                self.handle_client_command(garbagecommand, prepare=True)
            else:
                self.handle_client_command(garbagecommand)
        if self.debug: self.logger.write("State:", "returning from performcore!")
dataset/ETHPy150Open denizalti/concoord/concoord/replica.py/Replica.performcore/swapped operands of `not in`