code: def _time_interval_repair(df, dt_col, intervals, id_col=None):
      """
      This check is used to get consitent time interval by resample data according to
      the mode of original intervals.
      """
      if id_col is not None and intervals is None:
          # multi_id case
          from bigdl.chronos.data.utils.resample import (
              resample_timeseries_dataframe,
          )
  
          try:
  
              def resample_interval(x):
                  df_column = x[dt_col]
                  interval = df_column.shift(-1) - df_column
                  intervals = interval[:-1]
                  mode = intervals.mode()[0]  # Timedelta
                  df = resample_timeseries_dataframe(
                      x, dt_col=dt_col, interval=mode, id_col=id_col
                  )
                  return df
  
              new_df = df.groupby(id_col, as_index=False).apply(
                  resample_interval
              )
              new_df.reset_index(drop=True, inplace=True)
              logging.warning("Dataframe has be resampled.")
              return new_df, True
          except:
              return df, False
      else:
          mode = intervals[:-1].mode()[0]  # Timedelta
          from bigdl.chronos.data.utils.resample import (
              resample_timeseries_dataframe,
          )
  
          # TODO: how to change into inplace modification
          try:
              df = resample_timeseries_dataframe(
                  df, dt_col=dt_col, interval=mode, id_col=id_col
              )
              logging.warning(
                  f"Dataframe has be resampled according to interval {mode}."
              )
              return df, True
          except:
              return df, False
  
file_path: BigDL/python/chronos/src/bigdl/chronos/data/utils/quality_inspection.py
imports: import pandas
  import numpy
  from bigdl.nano.utils.common import invalidInputError
  import logging
label_desc: Use image node_id 5 for calling a global function with example usage: _time_interval_repair(df, dt_col, intervals, id_col) and returns: new_df,  True, df,  True, df, df,  False, df,  False