Python implementation of a doubly linked list