python: linked list cycle