code: def find_time_threshold(
      df, n_lags, n_forecasts, valid_p, inputs_overbleed
  ):
      """Find time threshold for dividing timeseries into train and validation sets.
      Prevents overbleed of targets. Overbleed of inputs can be configured.
  
      Parameters
      ----------
          df : pd.DataFrame
              data with column ``ds``, ``y``, and ``ID``
          n_lags : int
              identical to NeuralProphet
          valid_p : float
              fraction (0,1) of data to use for holdout validation set
          inputs_overbleed : bool
              Whether to allow last training targets to be first validation inputs (never targets)
  
      Returns
      -------
          str
              time stamp threshold defines the boundary for the train and validation sets split.
      """
      df_merged = merge_dataframes(df)
      n_samples = len(df_merged) - n_lags + 2 - (2 * n_forecasts)
      n_samples = n_samples if inputs_overbleed else n_samples - n_lags
      if 0.0 < valid_p < 1.0:
          n_valid = max(1, int(n_samples * valid_p))
      else:
          assert valid_p >= 1
          assert isinstance(valid_p, int)
          n_valid = valid_p
      n_train = n_samples - n_valid
      threshold_time_stamp = df_merged.loc[n_train, "ds"]
      log.debug("Time threshold: ", threshold_time_stamp)
      return threshold_time_stamp
  
imports: from __future__ import annotations
  import logging
  import math
  from collections import OrderedDict
  from dataclasses import dataclass
  from typing import TYPE_CHECKING, List, Optional, Tuple
  import numpy
  import pandas
label_desc: Use image node_id 17 for calling a global function with example usage: find_time_threshold(df, n_lags, n_forecasts, valid_p, inputs_overbleed) and returns: threshold_time_stamp