@spin_first<EOL><INDENT>def shutdown(self, targets='<STR_LIT:all>', restart=False, hub=False, block=None):<DEDENT>
if restart:<EOL><INDENT>raise NotImplementedError("<STR_LIT>")<EOL><DEDENT>block = self.block if block is None else block<EOL>if hub:<EOL><INDENT>targets = '<STR_LIT:all>'<EOL><DEDENT>targets = self._build_targets(targets)[<NUM_LIT:0>]<EOL>for t in targets:<EOL><INDENT>self.session.send(self._control_socket, '<STR_LIT>',<EOL>content={'<STR_LIT>':restart},ident=t)<EOL><DEDENT>error = False<EOL>if block or hub:<EOL><INDENT>self._flush_ignored_control()<EOL>for i in range(len(targets)):<EOL><INDENT>idents,msg = self.session.recv(self._control_socket, <NUM_LIT:0>)<EOL>if self.debug:<EOL><INDENT>pprint(msg)<EOL><DEDENT>if msg['<STR_LIT:content>']['<STR_LIT:status>'] != '<STR_LIT>':<EOL><INDENT>error = self._unwrap_exception(msg['<STR_LIT:content>'])<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>self._ignored_control_replies += len(targets)<EOL><DEDENT>if hub:<EOL><INDENT>time.sleep(<NUM_LIT>)<EOL>self.session.send(self._query_socket, '<STR_LIT>')<EOL>idents,msg = self.session.recv(self._query_socket, <NUM_LIT:0>)<EOL>if self.debug:<EOL><INDENT>pprint(msg)<EOL><DEDENT>if msg['<STR_LIT:content>']['<STR_LIT:status>'] != '<STR_LIT>':<EOL><INDENT>error = self._unwrap_exception(msg['<STR_LIT:content>'])<EOL><DEDENT><DEDENT>if error:<EOL><INDENT>raise error<EOL><DEDENT>
Terminates one or more engine processes, optionally including the hub.

        Parameters
        ----------

        targets: list of ints or 'all' [default: all]
            Which engines to shutdown.
        hub: bool [default: False]
            Whether to include the Hub.  hub=True implies targets='all'.
        block: bool [default: self.block]
            Whether to wait for clean shutdown replies or not.
        restart: bool [default: False]
            NOT IMPLEMENTED
            whether to restart engines after shutting them down.