def count_all(seq, reverse=None):
    """
    Return a list of (value, count) pairs for each unique value in L.

    The result can be sorted from the least frequent to the most frequent if
    `reverse=False` or otherwise if reverse=True`.

    Examples:
        >>> count_all([10, 20, 10, 20, 30, 20], reverse=True)
        [(20, 3), (10, 2), (30, 1)]
    """
    countD = {}
    for idx, x in enumerate(seq):
        try:
            countD[x] = countD.get(x, 0) + 1
        except TypeError:
            break
    else:
        idx = None
    out = list(countD.items())
    if idx is not None:
        countL = list(countD.items())
        for i in range(idx, len(seq)):
            x = seq[i]
            for i, (y, c) in enumerate(countL):
                if y == x:
                    out[i] = x, c + 1
                    break
            else:
                out.append((x, 1))
    if reverse is not None:
        out.sort(key=lambda x: x[1], reverse=reverse)
    return out
