'Return the objects (Items or Albums) sorted by descending
order of priority.
If provided, the `tiebreak` dict indicates the field to use to
prioritize the objects. Otherwise, Items are placed in order of
"completeness" (objects with more non-null fields come first)
and Albums are ordered by their track count.'

def _order(self, objs, tiebreak=None):

    if tiebreak:
        kind = ('items' if all((isinstance(o, Item) for o in objs)) else 'albums')
        key = (lambda x: tuple((getattr(x, k) for k in tiebreak[kind])))
    else:
        kind = (Item if all((isinstance(o, Item) for o in objs)) else Album)
        if (kind is Item):
            def truthy(v):
                return ((v is not None) and ((v != '') if isinstance(v, six.text_type) else True))
            fields = kind.all_keys()
            key = (lambda x: sum((1 for f in fields if truthy(getattr(x, f)))))
        else:
            key = (lambda x: len(x.items()))
    return sorted(objs, key=key, reverse=True)
