code: def fix_insert(self, node):
      # case 1 the parent is null, then set the inserted node as root and color = 0
      if node.parent is None:
          node.color = 0
          self.root = node
          return
          # case 2 the parent color is black, do nothing
      # case 3 the parent color is red
      while node.parent and node.parent.color == 1:
          if node.parent is node.parent.parent.left:
              uncle_node = node.parent.parent.right
              if uncle_node and uncle_node.color == 1:
                  # case 3.1 the uncle node is red
                  # then set parent and uncle color is black and grandparent is red
                  # then node => node.parent
                  node.parent.color = 0
                  node.parent.parent.right.color = 0
                  node.parent.parent.color = 1
                  node = node.parent.parent
                  continue
              elif node is node.parent.right:
                  # case 3.2 the uncle node is black or null, and the node is right of parent
                  # then set his parent node is current node
                  # left rotate the node and continue the next
                  node = node.parent
                  self.left_rotate(node)
              # case 3.3 the uncle node is black and parent node is left
              # then parent node set black and grandparent set red
              node.parent.color = 0
              node.parent.parent.color = 1
              self.right_rotate(node.parent.parent)
          else:
              uncle_node = node.parent.parent.left
              if uncle_node and uncle_node.color == 1:
                  # case 3.1 the uncle node is red
                  # then set parent and uncle color is black and grandparent is red
                  # then node => node.parent
                  node.parent.color = 0
                  node.parent.parent.left.color = 0
                  node.parent.parent.color = 1
                  node = node.parent.parent
                  continue
              elif node is node.parent.left:
                  # case 3.2 the uncle node is black or null, and the node is right of parent
                  # then set his parent node is current node
                  # left rotate the node and continue the next
                  node = node.parent
                  self.right_rotate(node)
              # case 3.3 the uncle node is black and parent node is left
              # then parent node set black and grandparent set red
              node.parent.color = 0
              node.parent.parent.color = 1
              self.left_rotate(node.parent.parent)
      self.root.color = 0
  
file_path: keon-algos/algorithms/tree/red_black_tree/red_black_tree.py
label_desc: Use image node_id 5 for calling the RBTree obj's underlying member method code with example usage: obj.fix_insert(node) without return types