def uniform_bins(seq, bins=100):
    """Returns unique bin edges for an iterable of numbers.

    Note: to make edges unique, drops duplicate edges, for large
    datasets with many duplicates in a skewed distribution, this
    could result in fewer bins than requested.

    Params
    ------
    seq  : iterable of numbers
    bins : int

    Returns
    -------
    edges : list
        A list of edges, the first is the first entry of seq, the last
        is the last entry, all others are approximately evenly sized
    """
    avg = len(seq)/float(bins)
    out = [seq[0]]
    last = 0.0

    while last < len(seq)-avg:
        bin_edge = seq[int(last + avg)]
        if bin_edge not in out:
            out.append(bin_edge)
        last += avg

    # Guarantee that right edge is included
    if seq[-1] not in out:
        out.append(seq[-1])

    return out