code: def contaminate_df_with_anomalies(
      df,
      anomaly_block_list,
      delta_range_lower,
      delta_range_upper,
      value_col="y",
      min_admissible_value=None,
      max_admissible_value=None,
  ):
      """Contaminate a dataframe with anomalies. If original value is y, the anomalous value is (1 +/- delta)y,
      the + or - chosen randomly.
  
      :param df: pd.DataFrame
          dataframe with values in column named "y"
      :param anomaly_block_list: list
          list of blocks of indices to insert anomalies in
      :param delta_range_lower: float
          lower boundary of the interval to choose delta from
      :param delta_range_upper: float
          upper boundary of the interval to choose delta from
      :param value_col: str
          The value columns which is to be contaminated
      :param min_admissible_value: Optional[float]
          minimum admissible value in df["y"]
      :param max_admissible_value: Optional[float]
          maximum admissible value in df["y"]
  
      :return: pd.DataFrame
          contains the dataframe df with two columns appended:
              "contaminated_y": values from column "y" changed to have outliers in the blocks given by anomaly_block_list
              "is_anomaly": 0 for clean point, 1 for outlier
      """
      y = np.array(df[value_col])
      is_anomaly = np.zeros(df.shape[0], dtype=float)
      for i in range(len(anomaly_block_list)):
          index_set = anomaly_block_list[i]
          # generate a random sign: either 1 or -1
          s = 2 * np.random.binomial(1, 0.5, 1) - 1
          for j in index_set:
              multiplier = 1 + (
                  s
                  * np.random.uniform(
                      delta_range_lower, delta_range_upper, 1
                  )
              )
              y[j] = y[j] * multiplier
              if min_admissible_value is not None:
                  y[j] = max(min_admissible_value, y[j])
              if max_admissible_value is not None:
                  y[j] = min(max_admissible_value, y[j])
              is_anomaly[j] = 1
      df["contaminated_y"] = y
      df["is_anomaly"] = is_anomaly
      return df
  
imports: import datetime
  import numpy
  import pandas
  from greykite.common.testing_utils import generate_df_for_tests
label_desc: Use image node_id 2 for calling a global function with example usage: contaminate_df_with_anomalies(df, anomaly_block_list, delta_range_lower, delta_range_upper, value_col, min_admissible_value, max_admissible_value) and returns: df