input: Write a python function to check if a linked list contains a loop.
  assert contains_loop(node1) == True  # Assuming node1 is the head of a linked list that contains a loop
  assert contains_loop(node2) == False  # Assuming node2 is the head of a linked list that does not contain a loop
  assert contains_loop(node3) == True  # Assuming node3 is the head of another linked list that contains a loop
output: def contains_loop(head):
      slow = head
      fast = head
      while fast and fast.next:
          slow = slow.next
          fast = fast.next.next
          if slow == fast:
              return True
      return False