code: def save(self, nodedict, root=''):
          
          setitem = super().__setitem__
          getitem = super().__getitem__
          tag = nodedict['tag']
          text = nodedict.get('text', None)
          if hasattr(text, 'strip'):
              text = text.strip()
          attrib = nodedict.get('attrib', {})
          path = '/'.join([root, tag])
          nodes = nodedict.get('nodes', [])
          if text not in ('', None):  # text=0 is stored
              try:
                  setitem(path, text)
              except Exception as exc:
                  sys.stderr.write('%s: %s\n' % (path, exc))
                  raise
          elif attrib and not nodes:
              setitem(path, numpy.nan)
          for subdict in _resolve_duplicates(nodes):
              self.save(subdict, path)
          if attrib:
              dset = getitem(path)
              for k, v in attrib.items():
                  dset.attrs[k] = maybe_encode(v)
docs: Save a node dictionary in the .hdf5 file, starting from the root
          dataset. A common application is to convert XML files into .hdf5
          files, see the usage in :mod:`openquake.commands.to_hdf5`.
  
          :param nodedict:
              a dictionary with keys 'tag', 'attrib', 'text', 'nodes'