python script to repair the primary range of a node in N discrete steps