code: def trunc_segments(
      ta: TimeAdjuster,
      segments: Dict[str, pd.Timestamp],
      days,
      test_key="test",
  ):
      """
      To avoid the leakage of future information, the segments should be truncated according to the test start_time
  
      NOTE:
          This function will change segments **inplace**
      """
      # adjust segment
      test_start = min(t for t in segments[test_key] if t is not None)
      for k in list(segments.keys()):
          if k != test_key:
              segments[k] = ta.truncate(segments[k], test_start, days)
  
imports: import abc
  import copy
  import pandas
  from typing import Dict, List, Union, Callable
  from qlib.utils import transform_end_date
  from .utils import TimeAdjuster
label_desc: Use image node_id 3 for calling a global function with example usage: trunc_segments(ta, segments, days, test_key) without return types