'Returns an ordered list of the user names for a tag; list is ordered from
most popular to least popular name.'

def _get_usernames_for_tag(self, trans, user, tag, item_class, item_tag_assoc_class):

    cols_to_select = [item_tag_assoc_class.table.c.user_tname, func.count('*')]
    where_clause = and_((item_tag_assoc_class.table.c.user_id == user.id), (item_tag_assoc_class.table.c.tag_id == tag.id))
    group_by = item_tag_assoc_class.table.c.user_tname
    order_by = [func.count('*').desc()]
    query = select(columns=cols_to_select, whereclause=where_clause, group_by=group_by, order_by=order_by)
    result_set = trans.sa_session.execute(query)
    user_tag_names = list()
    for row in result_set:
        user_tag_names.append(row[0])
    return user_tag_names
