deque operation deque contents return value is_empty( add_rear( add_rear('dog' add_front('cat' add_front(trued size( is_empty( add_rear( remove_rear( remove_front([[ ['dog', ,['dog', ,'cat'['dog', ,'cat',true['dog', ,'cat',true['dog', ,'cat',true[ ,'dog', ,'cat',true['dog', ,'cat',true['dog', ,'cat'true false true table examples of deque operations add_rear(itemadds new item to the rear of the deque it needs the item and returns nothing remove_front(removes the front item from the deque it needs no parameters and returns the item the deque is modified remove_rear(removes the rear item from the deque it needs no parameters and returns the item the deque is modified is_empty(tests to see whether the deque is empty it needs no parameters and returns boolean value size(returns the number of items in the deque it needs no parameters and returns an integer as an exampleif we assume that is deque that has been created and is currently emptythen table shows the results of sequence of deque operations note that the contents in front are listed on the right it is very important to keep track of the front and the rear as you move items in and out of the collection as things can get bit confusing implementing deque in python as we have done in previous sectionswe will create new class for the implementation of the abstract data type deque againthe python list will provide very nice set of methods upon which to build the details of the deque our implementation will assume that the rear of the deque is at position in the list completed implementation of deque adt class dequedef __init__(self)self items [def is_empty(self)return self items =[def add_front(selfitem) deques