RF+BF: Refactor uniquemerge2literal to support multi-dim attributes

This also removes the custom conditional wrapping fo return values into
lists to imply a conversion scheme. Now this function always returns
sequences if it does its job. However, the special case of returning
None for empty sequences and the input for non-sequences are maintained
for backward-compatibility.

Add a dedicated test.