code: def _get_work_item_key(self) -> UniqueKey:
      pp_rank = self.pp_rank
      stage_num = self.actual_stage_num
      real_microbatch_num = self.num_microbatches // 2
  
      forward_block_size = (
          1
          if self.num_microbatches < stage_num
          else self.num_microbatches // stage_num
      )
      forward_block_num = self.forward_times // forward_block_size
  
      if self.forward_times >= real_microbatch_num or (
          (pp_rank + 1) % stage_num == 0
          and forward_block_num > self.backward_times
      ):
          target_phase = Phase.BACKWARD
          target_microbatch_id = self.backward_times
      else:  # others
          target_phase = Phase.FORWARD
          target_microbatch_id = self.forward_times
  
      # In up pipeline, microbatch_id to consume is 0, 2, 4 (2n)
      # In down pipeline, microbatch_id to consume is 1, 3, 5 (2n + 1)
      real_target_microbatch_id = target_microbatch_id * 2
      if pp_rank >= stage_num:
          real_target_microbatch_id += 1
      target_key = UniqueKey(real_target_microbatch_id, target_phase)
  
      with self.work_list_condition_lock:
          self.work_list_condition_lock.wait_for(
              lambda: target_key in self.work_list
          )
      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 2 for calling the ChimeraWorker obj's underlying member method code with example usage: obj._get_work_item_key() and returns: target_key