def launch_subshell(self, shell_cls, cmd, args, *, prompt = None, context =
            {}):
        """Launch a subshell.

        The doc string of the cmdloop() method explains how shell histories and
        history files are saved and restored.

        The design of the _ShellBase class encourage launching of subshells through
        the subshell() decorator function. Nonetheless, the user has the option
        of directly launching subshells via this method.

        Arguments:
            shell_cls: The _ShellBase class object to instantiate and launch.
            args: Arguments used to launch this subshell.
            prompt: The name of the subshell. The default, None, means
                to use the shell_cls.__name__.
            context: A dictionary to pass to the subshell as its context.

        Returns:
            'root': Inform the parent shell to keep exiting until the root shell
                is reached.
            'all': Exit the the command line.
            False, None, or anything that are evaluated as False: Inform the
                parent shell to stay in that parent shell.
            An integer indicating the depth of shell to exit to. 0 = root shell.
        """
        # Save history of the current shell.
        readline.write_history_file(self.history_fname)

        prompt = prompt if prompt else shell_cls.__name__
        mode = _ShellBase._Mode(
                shell = self,
                cmd = cmd,
                args = args,
                prompt = prompt,
                context = context,
        )
        shell = shell_cls(
                batch_mode = self.batch_mode,
                debug = self.debug,
                mode_stack = self._mode_stack + [ mode ],
                pipe_end = self._pipe_end,
                root_prompt = self.root_prompt,
                stdout = self.stdout,
                stderr = self.stderr,
                temp_dir = self._temp_dir,
        )
        # The subshell creates its own history context.
        self.print_debug("Leave parent shell '{}'".format(self.prompt))
        exit_directive = shell.cmdloop()
        self.print_debug("Enter parent shell '{}': {}".format(self.prompt, exit_directive))

        # Restore history. The subshell could have deleted the history file of
        # this shell via 'history clearall'.
        readline.clear_history()
        if os.path.isfile(self.history_fname):
            readline.read_history_file(self.history_fname)

        if not exit_directive is True:
            return exit_directive
Launch a subshell.

        The doc string of the cmdloop() method explains how shell histories and
        history files are saved and restored.

        The design of the _ShellBase class encourage launching of subshells through
        the subshell() decorator function. Nonetheless, the user has the option
        of directly launching subshells via this method.

        Arguments:
            shell_cls: The _ShellBase class object to instantiate and launch.
            args: Arguments used to launch this subshell.
            prompt: The name of the subshell. The default, None, means
                to use the shell_cls.__name__.
            context: A dictionary to pass to the subshell as its context.

        Returns:
            'root': Inform the parent shell to keep exiting until the root shell
                is reached.
            'all': Exit the the command line.
            False, None, or anything that are evaluated as False: Inform the
                parent shell to stay in that parent shell.
            An integer indicating the depth of shell to exit to. 0 = root shell.