def condense_repeats(ll, use_is=True):
    """
    Count the number of consecutive repeats in a list.

    Essentially, a way of doing `uniq -c`

    Parameters
    ----------
    ll : list
        a list

    Returns
    -------
    list of tuples
        list of 2-tuples in the format (element, repeats) where element is
        the element from the list, and repeats is the number of consecutive
        times it appeared
    """
    count = 0
    old = None
    vals = []
    for e in ll:
        if (use_is and e is old) or (not use_is and e == old):
            count += 1
        else:
            if old is not None:
                vals.append((old, count))
            count = 1
            old = e
    vals.append((old, count))
    return vals