There should probably be a `_decode_attrs` helper function.

As a minor style point: I don't think the `\` is necessary.