Convert a tree, possibly containing custom data types that aren’t directly representable in YAML, to a tree of basic data types, annotated with tags.