code: def test_nested_sessions(allow_children):
      with _TrainingSession(PARENT, allow_children=allow_children) as p:
          assert_session_stack([(None, PARENT)])
  
          with _TrainingSession(CHILD, allow_children=True) as c:
              assert_session_stack([(None, PARENT), (PARENT, CHILD)])
              assert p.should_log()
              assert c.should_log() == allow_children
  
          assert_session_stack([(None, PARENT)])
      assert_session_stack([])
  
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 5 for calling a global function with example usage: test_nested_sessions(allow_children) without return types