docs: def node_from_dict(dic, nodefactory=Node):
      """
      Convert a (nested) dictionary with attributes tag, attrib, text, nodes
      into a Node object.
      """
      tag = dic['tag']
      text = dic.get('text')
      attrib = dic.get('attrib', {})
      nodes = dic.get('nodes', [])
      if not nodes:
          return nodefactory(tag, attrib, text)
      return nodefactory(tag, attrib, nodes=list(map(node_from_dict, nodes)))