linked list cycle in python