code: def move_node(self, parent, from_index, to_index):
          
  
          # TODO: Should be refactored once this ticket is fixed:
          # https://bugreports.qt-project.org/browse/PYSIDE-78
          if not from_index >= 0 or \
                  not from_index < parent.children_count() or \
                  not to_index >= 0 or \
                  not to_index < parent.children_count():
              return False
  
          parent_index = self.get_node_index(parent)
          self.beginRemoveRows(parent_index, from_index, from_index)
          child = parent.remove_child(from_index)
          self.endRemoveRows()
  
          start_index = parent.children_count() - 1
          end_index = to_index - 1
  
          tail = []
          for i in range(start_index, end_index, -1):
              self.beginRemoveRows(parent_index, i, i)
              tail.append(parent.remove_child(i))
              self.endRemoveRows()
          tail = list(reversed(tail))
          tail.insert(0, child)
  
          for node in tail:
              row = parent.children_count()
              self.beginInsertRows(parent_index, row, row)
              parent.add_child(node)
              self.endInsertRows()
  
          return True
docs: Moves given parent child to given index.
  
          :param to_index: Index to.
          :type to_index: int
          :param from_index: Index from.
          :type from_index: int
          :return: Method success.
          :rtype: bool