Justification of the complex Langevin method with the gauge cooling procedure