code: def holidays_timeseries(
      time_index: Union[TimeSeries, pd.DatetimeIndex],
      country_code: str,
      prov: str = None,
      state: str = None,
      column_name: Optional[str] = "holidays",
      until: Optional[Union[int, str, pd.Timestamp]] = None,
      add_length: int = 0,
      dtype: np.dtype = np.float64,
      tz: Optional[str] = None,
  ) -> TimeSeries:
      """
      Creates a binary univariate TimeSeries with index `time_index` that equals 1 at every index that lies within
      (or equals) a selected country's holiday, and 0 otherwise.
  
      Available countries can be found `here <https://github.com/dr-prodigy/python-holidays#available-countries>`_.
  
      Parameters
      ----------
      time_index
          Either a `pd.DatetimeIndex` or a `TimeSeries` for which to generate the holidays.
      country_code
          The country ISO code.
      prov
          The province.
      state
          The state.
      until
          Extend the time_index up until timestamp for datetime indexed series
          and int for range indexed series, should match or exceed forecasting window.
      add_length
          Extend the time_index by add_length, should match or exceed forecasting window.
          Set only one of until and add_length.
      column_name
          Optionally, the name of the value column for the returned TimeSeries.
      dtype
          The desired NumPy dtype (np.float32 or np.float64) for the resulting series.
      tz
          Optionally, a time zone to convert the time index to before generating the holidays.
  
      Returns
      -------
      TimeSeries
          A new binary holiday TimeSeries instance.
      """
      time_index_ts, time_index = _process_time_index(
          time_index=time_index,
          tz=tz,
          until=until,
          add_length=add_length,
      )
  
      scope = range(
          time_index[0].year,
          (time_index[-1] + pd.Timedelta(days=1)).year,
      )
      country_holidays = holidays.country_holidays(
          country_code, prov=prov, state=state, years=scope
      )
      index_series = pd.Series(time_index, index=time_index)
      values = index_series.apply(
          lambda x: x in country_holidays
      ).astype(dtype)
      return TimeSeries.from_times_and_values(
          time_index_ts, values, columns=pd.Index([column_name])
      )
  
file_path: darts/darts/utils/timeseries_generation.py
imports: import math
  from typing import List, Optional, Sequence, Tuple, Union
  import holidays
  import numpy
  import pandas
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
label_desc: Use image node_id 9 for calling a global function with example usage: holidays_timeseries(time_index, country_code, prov, state, column_name, until, add_length, dtype, tz) and returns: TimeSeries