Add function for testing if run mode is ipython or mpi
Unify ipython and mpi context interface.

This is done by checking if the running program has mpi.comm_world.size
== 1 when it is run. This is case with IPython. With MPI, mpi.comm_world
size == nengines + 1