I have discovered the magic command %%python
thanks to this answer, where it prevents a crash of the IPython's kernel after a Tkinter window is closed.
According to the documentation:
%%python
%%python script magic
Run cells with python in a subprocess.
Has this magic command any other use?