docs: def assert_optimizer_pickle_matches_for_phase(phase):
      """
      Assert that the previously saved optimizer is equal to the phase's optimizer if a saved optimizer is found.
  
      Parameters
      ----------
      phase
          The phase
  
      Raises
      -------
      exc.PipelineException
      """
      path = make_optimizer_pickle_path(phase)
      if os.path.exists(path):
          with open(path, "r+b") as f:
              loaded_optimizer = pickle.loads(f.read())
              if phase.optimizer != loaded_optimizer:
                  raise exc.PipelineException(
                      f"Can't restart phase at path {path} because settings don't match. "
                      f"Did you change the optimizer settings or model?")