Connect to an IPython kernel as soon as its message is logged.

def connect_to_ipykernel(self, service_name, timeout=10):
        """Connect to an IPython kernel as soon as its message is logged."""
        kernel_json_file = self.wait_for_ipykernel(service_name, timeout=10)
        self.start_interactive_mode()
        subprocess.check_call([
            sys.executable, "-m", "IPython", "console", "--existing", kernel_json_file
        ])
        self.stop_interactive_mode()