def start(self):
if self.mode == "<STR_LIT>":<EOL><INDENT>return<EOL><DEDENT>if self.ipython_dir != '<STR_LIT>':<EOL><INDENT>self.ipython_dir = os.path.abspath(os.path.expanduser(self.ipython_dir))<EOL><DEDENT>if self.log:<EOL><INDENT>stdout = open(os.path.join(self.ipython_dir, "<STR_LIT>".format(self.profile)), '<STR_LIT:w>')<EOL>stderr = open(os.path.join(self.ipython_dir, "<STR_LIT>".format(self.profile)), '<STR_LIT:w>')<EOL><DEDENT>else:<EOL><INDENT>stdout = open(os.devnull, '<STR_LIT:w>')<EOL>stderr = open(os.devnull, '<STR_LIT:w>')<EOL><DEDENT>try:<EOL><INDENT>opts = [<EOL>'<STR_LIT>',<EOL>'<STR_LIT>' if self.ipython_dir == '<STR_LIT>' else '<STR_LIT>'.format(self.ipython_dir),<EOL>self.interfaces if self.interfaces is not None else '<STR_LIT>',<EOL>'<STR_LIT>' if self.profile == '<STR_LIT:default>' else '<STR_LIT>'.format(self.profile),<EOL>'<STR_LIT>' if self.reuse else '<STR_LIT>',<EOL>'<STR_LIT>'.format(self.public_ip) if self.public_ip else '<STR_LIT>',<EOL>'<STR_LIT>'.format(self.port) if self.port is not None else '<STR_LIT>'<EOL>]<EOL>if self.port_range is not None:<EOL><INDENT>opts += [<EOL>'<STR_LIT>'.format(self.hb_ping, self.hb_pong),<EOL>'<STR_LIT>'.format(self.control_client, self.control_engine),<EOL>'<STR_LIT>'.format(self.mux_client, self.mux_engine),<EOL>'<STR_LIT>'.format(self.task_client, self.task_engine)<EOL>]<EOL><DEDENT>logger.debug("<STR_LIT>".format('<STR_LIT:U+0020>'.join([str(x) for x in opts])))<EOL>self.proc = subprocess.Popen(opts, stdout=stdout, stderr=stderr, preexec_fn=os.setsid)<EOL><DEDENT>except FileNotFoundError:<EOL><INDENT>msg = "<STR_LIT>"<EOL>logger.error(msg)<EOL>raise ControllerError(msg)<EOL><DEDENT>except Exception as e:<EOL><INDENT>msg = "<STR_LIT>".format(e)<EOL>logger.error(msg)<EOL>raise ControllerError(msg)<EOL><DEDENT>
Start the controller.