Generalized way to convert a string to tree, and vice versa. Useful for creating declarative tree tests.