code: def _get_work_item_key(self) -> UniqueKey:
      # execute backward first (if backward phase in work_list)
      pp_rank = self.pp_rank
      actual_stage_num = self.actual_stage_num
      num_microbatches = self.num_microbatches
      is_last_stage = pp_rank == actual_stage_num - 1
  
      if self.outstanding <= self.outstanding_range[0]:
          target_phase = Phase.FORWARD
          target_microbatch_id = self.forward_times
      elif self.outstanding >= self.outstanding_range[1]:
          target_phase = Phase.BACKWARD
          target_microbatch_id = self.backward_times
      else:
          raise ValueError(
              "outstanding_range[1] - outstanding_range[0] must be in [0, 1]"
          )
  
      target_key = UniqueKey(target_microbatch_id, target_phase)
  
      # change outstanding_range at:
      # 1. forward times reach actual_stage_num, this is the end of continuous forward
      # 2. forward times reach num_microbatches, this is the end of 1F1B mode
      if not is_last_stage and target_key.phase == Phase.FORWARD:
          if (
              target_key.microbatch_id == actual_stage_num - 1
              and num_microbatches > 2
          ):
              # Why need num_microbatches > 2 ? Because there is no steady stage when num_microbatches <= 2
              outstanding_min = actual_stage_num - pp_rank - 1
              outstanding_max = actual_stage_num - pp_rank
              self.outstanding_range = (
                  outstanding_min,
                  outstanding_max,
              )
          if target_key.microbatch_id == num_microbatches - 1:
              self.outstanding_range = (0, 0)
  
      return target_key
  
imports: import threading
  from typing import Callable, Dict, List
  import torch
  from torch._C._distributed_rpc import PyRRef
  from torch.futures import Future
  from colossalai.legacy.pipeline.pipeline_process_group import ppg
  from colossalai.legacy.pipeline.rpc._pipeline_base import Phase, PipelineEngineBase, UniqueKey, WorkerBase, WorkItem
label_desc: Use image node_id 1 for calling the OneFOneBWorker obj's underlying member method code with example usage: obj._get_work_item_key() and returns: target_key