code: def refresh_balance(self):
          
          left_depth = self.left_node.depth if self.left_node else 0
          right_depth = self.right_node.depth if self.right_node else 0
          self.depth = 1 + max(left_depth, right_depth)
          self.balance = right_depth - left_depth
docs: Recalculate self.balance and self.depth based on child node values.