I tried to find a place where to put this function. And seems the nv.utils is good enough for this purpose.