Linked Stack Algorithm In Python