docs: def dump(node, config):
      """
      Convert a node tree to a simple nested dict
  
      All steps in this conversion are configurable using DumpConfig
  
      dump dictionary node: {"type": str, "data": dict}
      """
      if config.is_node(node):
          fields = OrderedDict()
          for name in config.fields_iter(node):
              attr = config.field_val(node, name)
              if attr is not None:
                  fields[name] = dump(attr, config)
          return {"type": config.node_type(node), "data": fields}
      elif config.is_list(node):
          return [dump(x, config) for x in config.list_iter(node)]
      else:
          return config.leaf_val(node)