Wouldn't this function, and the one below, be better placed at fields.py? (perhaps even as methods of the Fields class... one thing i'd have there (not necessarily in this PR) are methods like `Fields.is_numeric()`, insead of sometimes using directly the array of fields and repeatedly write `fields[key]['optype']==...` and other times Fields instances...)