code: def _replace_range(data, new_data):
      dates = new_data.index.get_level_values("datetime")
      data = data.sort_index()
      data = data.drop(data.loc[dates.min() : dates.max()].index)
      cb_data = pd.concat([data, new_data], axis=0)
      cb_data = cb_data[
          ~cb_data.index.duplicated(keep="last")
      ].sort_index()
      return cb_data
  
imports: from abc import ABCMeta, abstractmethod
  from typing import Optional
  import pandas
  from qlib import get_module_logger
  from qlib.data import D
  from qlib.data.dataset import Dataset, DatasetH, TSDatasetH
  from qlib.data.dataset.handler import DataHandlerLP
  from qlib.model import Model
  from qlib.utils import get_date_by_shift
  from qlib.workflow.recorder import Recorder
  from qlib.workflow.record_temp import SignalRecord
label_desc: Use image node_id 1 for calling a global function with example usage: _replace_range(data, new_data) and returns: cb_data