code: def assert_session_stack(estimators):
      assert len(_TrainingSession._session_stack) == len(estimators)
  
      for idx, (sess, (parent_estimator, estimator)) in enumerate(
          zip(_TrainingSession._session_stack, estimators)
      ):
          assert sess.estimator is estimator
          if idx == 0:
              assert sess._parent is None
          else:
              assert sess._parent.estimator is parent_estimator
  
file_path: mlflow/tests/autologging/test_training_session.py
imports: import pytest
  from mlflow.utils.autologging_utils import _get_new_training_session_class
label_desc: Use image node_id 2 for calling a global function with example usage: assert_session_stack(estimators) without return types