Finish the etree function with tests and docs