We propose a nonlinear Schr\"odinger equation in a Hilbert space enlarged
with an ancilla such that the partial trace of its solution obeys to the
Lindblad equation of an open quantum system. The dynamics involved by this
nonlinear Schr\"odinger equation constitutes then a purification of the
Lindbladian dynamics. This nonlinear equation is compared with other
Schr\"odinger like equations appearing in the theory of open systems. We study
the (non adiabatic) geometric phases involved by this purification and show
that our theory unifies several definitions of geometric phases for open
systems which have been previously proposed. We study the geometry involved by
this purification and show that it is a complicated geometric structure related
to an higher gauge theory, i.e. a categorical bibundle with a connective
structure