docs: def stop_monitoring(self) -> None:
          """
          The recommended way of using Monitor is opening it with the `with` statement. In this case
          the user doesn't need to call this function explicitly. Otherwise the function should be
          called when the optimisation is done.
  
          The function sets the optimisation completed flag in the monitoring context and runs the
          tasks once more. If the monitor was created with the `print_summary` option it prints the
          tasks' timing summary.
          """
  
          self._context.optimisation_finished = True
          self._on_iteration()
  
          if self._print_summary:
              self.print_summary()