code: def make_test_preempt_context(
      dist: core.DistributedContext,
      mode: core.PreemptMode,
  ) -> Tuple[MockPreemptState, core.PreemptContext]:
      state = MockPreemptState()
      context = core.PreemptContext(
          state.mock_session, "allocation_id", dist, mode
      )
      return state, context
  
file_path: determined/harness/tests/core/test_preempt.py
imports: import threading
  import time
  from typing import Any, Dict, Tuple
  from unittest import mock
  import pytest
  from determined import core
  from tests import parallel
label_desc: Use image node_id 1 for calling a global function with example usage: make_test_preempt_context(dist, mode) and returns: state,  context