'Select the Nth child with the newest generation number (N > 1)'

def select_newest_child(self):

    selected_item = self.selected_item()
    if (selected_item is None):
        return
    if (len(selected_item.commit.children) > 1):
        children = selected_item.commit.children[1:]
    else:
        children = selected_item.commit.children
    child_item = self.newest_item(children)
    if (child_item is None):
        return
    selected_item.setSelected(False)
    child_item.setSelected(True)
    scene_rect = child_item.mapRectToScene(child_item.boundingRect())
    self.ensureVisible(scene_rect)
