'Convert words dictionary for client API.
:param top_words: Top words dictionary
:type top_words: dict
:param total_count: Total number of words
:type total_count: int
:rtype: list of dicts. Every dict is 3 keys: text - actual word,
size - counter of word, percent - percent in top_words dataset.
Calculates corrected percents for every top word:
For every word except last, it calculates rounded percent.
For the last is 100 - sum of all other percents.'

def prepare_words(self, top_words, total_count):

    list_to_return = []
    percents = 0
    for (num, word_tuple) in enumerate(top_words.iteritems()):
        if (num == (len(top_words) - 1)):
            percent = (100 - percents)
        else:
            percent = round(((100.0 * word_tuple[1]) / total_count))
            percents += percent
        list_to_return.append({'text': word_tuple[0], 'size': word_tuple[1], 'percent': percent})
    return list_to_return
