Cheat sheet for Circular Linked lists

class Node():
def __init__(self,data):
self.data = data
self.next = None
class CircularLinkedList():
def __init__(self):
self.head = None
def insert(self,new_data):
temp = self.head
new_node = Node(new_data)
if temp == None:
self.head = new_node
new_node.next = self.head

return
while(temp):
if temp.next == self.head:
temp.next = new_node
new_node.next = self.head
return
if temp.data < new_data:
prev = temp
temp = temp.next
if temp.data>new_data:
prev.next = new_node
new_node.next = temp
return

def print_em_all(self):
temp = self.head
while(temp):
print(temp.data)
temp = temp.next
if temp == self.head:
break