tree: using ast.iter_fields() instead of the protected attribute
code: trim spurious newlines