code: def get_no_changepoint_distance_from_end(
      min_increment: timedelta,
      forecast_horizon: int,
      min_num_points_after_last_changepoint: int = 1,
  ) -> str:
      """Gets the distance from end of time series where no changepoints will be placed.
  
      Parameters
      ----------
      min_increment : `datetime.timedelta`
          The minimum increment between time series points.
      forecast_horizon : `int`
          The forecast horizon.
      min_num_points_after_last_changepoint : `int`, default 1
          The minimum number of data points after the last potential changepoint.
  
      Returns
      -------
      no_changepoint_distance_from_end : `str`
          A string indicating the period from the end of the time series where no
          potential changepoints will be placed.
      """
      min_increment_in_days = min_increment.days
      min_forecast_horizon_in_days = (
          min_increment * forecast_horizon
      ).days
      if min_forecast_horizon_in_days < 1:
          min_forecast_horizon_in_days = 1
      # Minimum distance must be at least ``min_num_points_after_last_changepoint``.
      min_distance_days = (
          min_increment_in_days * min_num_points_after_last_changepoint
      )
      # We add extra constraints according to the data frequency,
      # and some special constraints for the commonly seen data frequencies.
      if min_increment_in_days >= 365:
          # At least yearly data, distance is at least 2 * forecast horizon.
          min_distance_days = max(
              min_distance_days, min_forecast_horizon_in_days * 2
          )
          if min_increment_in_days == 365:
              # Exactly yearly data, between 3 years and 20 years.
              min_distance_days = max(min_distance_days, 3 * 365)
              min_distance_days = min(min_distance_days, 20 * 366)
      elif min_increment_in_days >= 28:
          # Between monthly and yearly data, distance is between 3 * forecast horizon and 6 years.
          min_distance_days = max(
              min_distance_days, min_forecast_horizon_in_days * 3
          )
          min_distance_days = min(min_distance_days, 6 * 366)
          if min_increment_in_days == 90:
              # Exactly quarterly data, at least 4 quarters.
              min_distance_days = max(min_distance_days, 4 * 90)
          elif min_increment_in_days == 28:
              # Exactly monthly data, at least 3 months.
              min_distance_days = max(min_distance_days, 3 * 28)
      else:
          # Sub-monthly data, distance is at least 4 * forecast horizon.
          min_distance_days = max(
              min_distance_days, min_forecast_horizon_in_days * 4
          )
          if min_increment_in_days == 7:
              # Weekly data, between 8 weeks and 104 weeks (2 years).
              min_distance_days = max(min_distance_days, 8 * 7)
              min_distance_days = min(min_distance_days, 104 * 7)
          elif min_increment_in_days == 1:
              # Daily data, between 30 days and 1 year.
              min_distance_days = max(min_distance_days, 30)
              min_distance_days = min(min_distance_days, 365)
          elif min_increment_in_days < 1:
              # Sub-daily data, between 14 days and 1 year.
              min_distance_days = max(min_distance_days, 14)
              min_distance_days = min(min_distance_days, 365)
  
      no_changepoint_distance_from_end = f"{min_distance_days}D"
      return no_changepoint_distance_from_end
  
file_path: greykite/greykite/algo/changepoint/adalasso/auto_changepoint_params.py
imports: from datetime import timedelta
  from typing import Optional
  import numpy
  import pandas
  from pandas.tseries.frequencies import to_offset
  from greykite.algo.common.seasonality_inferrer import SeasonalityInferConfig
  from greykite.algo.common.seasonality_inferrer import SeasonalityInferrer
  from greykite.algo.common.seasonality_inferrer import TrendAdjustMethodEnum
  from greykite.common.constants import TIME_COL
  from greykite.common.constants import VALUE_COL
label_desc: Use image node_id 4 for calling a global function with example usage: get_no_changepoint_distance_from_end(min_increment, forecast_horizon, min_num_points_after_last_changepoint) and returns: no_changepoint_distance_from_end