code: def create_holiday_calendar(
      weekend_mask=None, holidays=None, start_year=None, end_year=None
  ):
      """Creates a holiday calendar.
  
      Each instance should be used in the context of only one graph. E.g. one can't
      create a HolidayCalendar in one tf.function and reuse it in another.
  
      Note: providing bounds for the calendar, i.e. `holidays` and/or `start_year`,
      `end_year` yields a better-performing calendar.
  
      Args:
        weekend_mask: Boolean `Tensor` of 7 elements one for each day of the week
          starting with Monday at index 0. A `True` value indicates the day is
          considered a weekend day and a `False` value implies a week day.
          Default value: None which means no weekends are applied.
        holidays: Defines the holidays that are added to the weekends defined by
          `weekend_mask`. An instance of `dates.DateTensor` or an object
          convertible to `DateTensor`.
          Default value: None which means no holidays other than those implied by
          the weekends (if any).
          Note that it is necessary to provide holidays for each year, and also
          adjust the holidays that fall on the weekends if required, e.g.
          2021-12-25 to 2021-12-24. To avoid doing this manually one can use
          AbstractHolidayCalendar from Pandas:
  
          ```python
          from pandas.tseries.holiday import AbstractHolidayCalendar
          from pandas.tseries.holiday import Holiday
          from pandas.tseries.holiday import nearest_workday
  
          class MyCalendar(AbstractHolidayCalendar):
              rules = [
                  Holiday('NewYear', month=1, day=1, observance=nearest_workday),
                  Holiday('Christmas', month=12, day=25,
                           observance=nearest_workday)
              ]
  
          calendar = MyCalendar()
          holidays_index = calendar.holidays(
              start=datetime.date(2020, 1, 1),
              end=datetime.date(2030, 12, 31))
          holidays = np.array(holidays_index.to_pydatetime(), dtype="<M8[D]")
          ```
  
        start_year: Integer giving the earliest year this calendar includes. If
          `holidays` is specified, then `start_year` and `end_year` are ignored,
          and the boundaries are derived from `holidays`.
          Default value: None which means start year is inferred from `holidays`, if
          present.
        end_year: Integer giving the latest year this calendar includes. If
          `holidays` is specified, then `start_year` and `end_year` are ignored,
          and the boundaries are derived from `holidays`.
          Default value: None which means start year is inferred from `holidays`, if
          present.
  
      Returns:
        A HolidayCalendar instance.
      """
      # Choose BoundedHolidayCalendar if possible, for better performance, otherwise
      # choose UnboundedHolidayCalendar.
      is_bounded = _tensor_is_not_empty(holidays) or (
          start_year is not None and end_year is not None
      )
      if is_bounded:
          return bounded_holiday_calendar.BoundedHolidayCalendar(
              weekend_mask, holidays, start_year, end_year
          )
      return unbounded_holiday_calendar.UnboundedHolidayCalendar(
          weekend_mask, holidays
      )
  
imports: import numpy
  import tensorflow.compat.v2
  from tf_quant_finance.datetime import bounded_holiday_calendar
  from tf_quant_finance.datetime import unbounded_holiday_calendar
label_desc: Use image node_id 1 for calling a global function with example usage: create_holiday_calendar(weekend_mask, holidays, start_year, end_year) and returns: unbounded_holiday_calendar, bounded_holiday_calendar