Improvements based on writing http://nedbatchelder.com/blog/201401/python_nugget_renumbering_ids.html
Improvements based on writing http://nedbatchelder.com/blog/201401/python_nugget_renumbering_ids.html

nedbat/cupid