class linkeddequedoublylinkedbase)note the use of inheritance """double-ended queue implementation based on doubly linked list "" def first(self) """return (but do not removethe element at the front of the deque "" if self is empty) raise empty("deque is empty"real item just after header return self header next element def last(self) """return (but do not removethe element at the back of the deque "" if self is empty) raise empty("deque is empty" return self trailer prev element real item just before trailer def insert first(selfe) """add an element to the front of the deque "" self insert between(eself headerself header nextafter header def insert last(selfe) """add an element to the back of the deque ""before trailer self insert between(eself trailer prevself trailer def delete first(self) """remove and return the element from the front of the deque raise empty exception if the deque is empty "" if self is empty) raise empty("deque is empty"use inherited method return self delete node(self header next def delete last(self) """remove and return the element from the back of the deque raise empty exception if the deque is empty "" if self is empty) raise empty("deque is empty"use inherited method return self delete node(self trailer prevcode fragment implementation of linkeddeque class that inherits from the doublylinkedbase class