def pythonShell(verbose = True): from slicer import app console = app.pythonConsole() if not console and verbose: print("Failed to obtain reference to python shell", file=sys.stderr) return console