Two helper functions are used above, one of which is moveToHead. This simply removes the node and re-adds it to the front, moving it ahead and letting us know it was the most recently used key.

Step Six
1def moveToHead(self, node):
2    self.removeNode(node)
3    self.addNode(node)