Refactor contrib/python/findnodes