convert from Python to Ruby for easier XML parsing