comparing by only the leaf attr was arguably wrong, as it ignored
any depth or parenting.
we use an fr_dict function to do the comparison. But that just
compares the pointers, and isn't stable. Arguably that should
be fixed, too.
The fix depends on whether we want to just sort different attributes,
or whether we want to order them. If we're just sorting them, then
the current code is OK.