def assign_fonts(counts,maxsize,minsize,exclude_words):
    '''Defines the font size of a word in the cloud.
    Counts is a list of tuples in the form (word,count)'''
    valid_counts = []
    if exclude_words:
        for i in counts:
            if i[1] != 1:
                valid_counts.append(i)
    else:
        valid_counts = counts
    frequencies = map(lambda x: x[1],valid_counts)
    words = map(lambda x: x[0],valid_counts)
    maxcount = max(frequencies)
    font_sizes = map(lambda x:fontsize(x,maxsize,minsize,maxcount),frequencies)
    size_dict = dict(zip(words, font_sizes))
    return size_dict