Restrict Range Slider to Select Maximum of two values

Hello Dash Community,

I am working on plotly dash app and I am trying to create a month range slider to appear on my frontend.

Following the post on the forum here I have worked out on how to create a range slider. Below is the code

maxmarks = 12
tday =  # gets timestamp of today
m1date = tday.month  # first month on slider
datelist = pd.date_range(tday, periods=maxmarks, freq='M')  # list of months as dates
dlist = pd.DatetimeIndex(datelist).normalize()
tags = {}  # dictionary relating marks on slider to tags. tags are shown as "Apr', "May', etc
datevalues = {}  # dictionary relating mark to date value
x = m1date
for i in dlist:
    tags[x] = (i + DateOffset(months=0)).strftime('%b')  # gets the string representation of next month ex:'Apr'
    datevalues[x] = i
    x = x + 1
    if x >= 13:
        x = x - 12

                        # updatemode='drag',
                        # count=1,
                        value=[maxmarks - 1, maxmarks],

However, I am looking for a way to allow a maximum of two tags selection on the range slider. Can someone please help me how to make this possible.

Thanks a lot in advance !!