import operator


def most_frequent_words(wordcounts, num):
    """Return a list of the top num most frequent words.
        The list is ordered by decreasing frequency.
    """
    items = wordcounts.items()
    items.sort(key=operator.itemgetter(1), reverse=True)
    return [items[i][0] for i in range(num)]