def is_population_diverse(pop, diversity_lim):
    """
    Check if the population is diverse. Returns true if the share
    of identical individuals in the population is higher than
    ``diversity_lim``.

    :param pop: Population
    :param diversity_lim: float (0-1), minimum share of identical individuals
                          defining non-diverse population
    :return: boolean
    """
    identical_count = 0
    total_count = len(pop.individuals)
    genes = list()
    for ind in pop.individuals:
        genes.append(ind.genes)
    for row in genes:
        dup = genes.count(row)
        if dup > identical_count:
            identical_count = dup
    is_diverse = True
    if float(identical_count) / float(total_count) > diversity_lim:
        is_diverse = False
    return is_diverse
