classMyCalendarTwo:def__init__(self): self.calendar = [] self.overlaps = []defbook(self,start,end):for i, j in self.overlaps:if start < j and end > i:returnFalsefor i, j in self.calendar:if start < j and end > i: self.overlaps.append((max(start, i), min(end, j))) self.calendar.append((start, end))returnTrue# Your MyCalendarTwo object will be instantiated and called as such:# obj = MyCalendarTwo()# param_1 = obj.book(start,end)