unify two copies of the NamedMDNode printing code.