code: def _heap_addition(weights: List, intervals: int, add_cnt: int):
      """ """
  
      def _heap_push(heap, st, ed):
          value = weights[ed - 1]
          if st > 0:
              value -= weights[st - 1]
          heapq.heappush(heap, (-value, st, ed))
  
      ret_intervals = []
      heap = []
  
      for st, ed in intervals:
          _heap_push(heap, st, ed)
  
      while add_cnt > 0:
          _, st, ed = heapq.heappop(heap)
          if ed - st == 1:
              ret_intervals.append((st, ed))
          else:
              l, m, r = _binary_partition(weights, st, ed)
              _heap_push(heap, l, m)
              _heap_push(heap, m, r)
              add_cnt -= 1
  
      while heap:
          _, st, ed = heapq.heappop(heap)
          ret_intervals.append((st, ed))
  
      ret_intervals.sort()
      return ret_intervals
  
file_path: ColossalAI/colossalai/legacy/pipeline/utils.py
imports: import heapq
  import inspect
  from collections import OrderedDict
  from typing import List
  import torch
  from colossalai.legacy.nn.layer.utils import CheckpointModule
  from colossalai.logging import get_dist_logger
label_desc: Use image node_id 2 for calling a global function with example usage: _heap_addition(weights, intervals, add_cnt) and returns: ret_intervals