def knt2mlt(t):
    t = np.atleast_1d(t)
    if t.ndim > 1:
        raise ValueError("t must be a list or a rank-1 array")
    out   = []
    e     = None
    for k in range(t.shape[0]):
        if t[k] != e:
            e     = t[k]
            count = 0
        else:
            count += 1
        out.append(count)
    return np.array( out )