Depending on how many items are in the list, nodes.index() may take long; it's an O(n). Maybe a dictionary is better suited and solves better also the indexing problem (map old to new position).

Again, take this as an advice, since I'm not familiar with this piece of code.