This parses the instance count dictionary
    (that may contain floats from 0.0 to 1.0 representing a percentage)
    and converts it to actual instance count.

def parse_instance_count(instance_count, speaker_total_count):
    """This parses the instance count dictionary
    (that may contain floats from 0.0 to 1.0 representing a percentage)
    and converts it to actual instance count.
    """

    # Use all the instances of a speaker unless specified
    result = copy.copy(speaker_total_count)
    for speaker_id, count in instance_count.items():
        speaker_id = str(speaker_id)
        speaker_total = speaker_total_count.get(speaker_id, 0)

        if type(count) == float and 0.0 <= count <= 1.0:
            result[speaker_id] = int(speaker_total * count)

        else:
            result[speaker_id] = int(count)

    return result