utils: new function for ordered hash traversal.