code: def test_get_timing_context(
      self, mock_record_function: MagicMock
  ) -> None:
      state = MagicMock()
      state.timer = None
  
      ctx = get_timing_context(state, "a")
      with ctx:
          time.sleep(1)
      mock_record_function.assert_called_with("a")
  
      state.timer = Timer()
      ctx = get_timing_context(state, "b")
      with ctx:
          time.sleep(1)
      self.assertTrue("b" in state.timer.recorded_durations.keys())
      mock_record_function.assert_called_with("b")
  
imports: import time
  import unittest
  from unittest.mock import MagicMock, patch
  from torchtnt.framework.utils import get_timing_context
  from torchtnt.utils.timer import Timer
label_desc: Use image node_id 1 for calling the UtilsTest obj's underlying member method code with example usage: obj.test_get_timing_context(mock_record_function) without return types