def dispatch(self, opcode, context):
        """Dispatches a context on a given opcode. Returns True if the context
        is done matching, False if it must be resumed when next encountered."""
        #if self.executing_contexts.has_key(id(context)):
        if id(context) in self.executing_contexts:
            generator = self.executing_contexts[id(context)]
            del self.executing_contexts[id(context)]
            has_finished = next(generator)
        else:
            method = self.DISPATCH_TABLE.get(opcode, _OpcodeDispatcher.unknown)
            has_finished = method(self, context)
            if hasattr(has_finished, "__next__"): # avoid using the types module
                generator = has_finished
                has_finished = next(generator)
        if not has_finished:
            self.executing_contexts[id(context)] = generator
        return has_finished
dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/_sre.py/_OpcodeDispatcher.dispatch/original