import math


def calculate_entropy(item_count, total_items):
    """
    Calculate the entropy present in a password/passphrase.
    Assumes item_count number of items(characters/words) were chosen
    uniformly from out of total_items number of items, calculated as:
        entropy = log2(total number of possibilities during generation), or
        entropy = log2(total_items**item_count), or
        entropy = item_count * log2(total_items)

    Keyword arguments:
        item_count -- Number of items present in the generated word/phrase
                        In a password this is simply the length
                        In a passphrase this is the number of words
        total_items -- Number of choices that were present
                        In a password this is the size of the choice alphabet
                        In a passphrase this is the number of words in the dictionary
    """
    return item_count * math.log2(total_items)