def mL2indx(m, L, lmax, lmin=0):
    """convert mL to column index
    Used for slicing the Kernel elements K.mLl (see tutorial)

    *lmin is always zero. It is merely presented in the args for clarity

    Usage example:

    m = 0
    L = 10
    lmax=100

    indx = cb.mL2indx(m, L, lmax)

    K_mL_slice = kernel.mLl[indx]

    """

    assert lmin==0
    #assert 0 <= m <= L, "m is outside of the valid range 0 <= m <= L"
    #assert 0 <= L <= lmax, "L is outside of the valid range 0 <= L <= lmax"
    return m*(2*lmax+1-m)//2+L