code: func (n *metadataNode) traverse(md []*api.PrefixMetadata, cb func(*metadataNode, []*api.PrefixMetadata) (bool, error)) error {
  	n.assertFrozen()
  
  	if md == nil {
  		md = n.metadata() // calculate from scratch
  	} else {
  		if n.md != nil {
  			md = append(md, n.md) // just extend what we have
  		}
  	}
  
  	switch cont, err := cb(n, md); {
  	case err != nil:
  		return err
  	case !cont:
  		return nil
  	}
  
  	keys := make([]string, 0, len(n.children))
  	for k := range n.children {
  		keys = append(keys, k)
  	}
  	sort.Strings(keys)
  
  	for _, k := range keys {
  		if err := n.children[k].traverse(md, cb); err != nil {
  			return err
  		}
  	}
  	return nil
  }
docs: // traverse does depth-first traversal of the node's subtree starting from self.
  //
  // 'md', if non-nil, is metadata from all previous parents (starting from the
  // root). If it is nil, all inherited metadata will be calculated from scratch.
  //
  // Note that non-nil empty 'md' slice is a valid value (it means there's nothing
  // to inherit), no recalculation will be done in this case.
  //
  // Children are visited in lexicographical order.