r'''Eigenvalue of the $\Op{J}_z$ (:class:`Jz`) operator

    .. math::

        \Op{J}_{z} \ket{s, m} = m \ket{s, m}

    See also :func:`Jpjmcoeff`.

def Jzjmcoeff(ls, m, shift) -> sympy.Expr:
    r'''Eigenvalue of the $\Op{J}_z$ (:class:`Jz`) operator

    .. math::

        \Op{J}_{z} \ket{s, m} = m \ket{s, m}

    See also :func:`Jpjmcoeff`.
    '''
    assert isinstance(ls, SpinSpace)
    n = ls.dimension
    s = sympify(n - 1) / 2
    assert n == int(2 * s + 1)
    if isinstance(m, str):
        return ls.basis.index(m) - s
    elif isinstance(m, int):
        if shift:
            assert 0 <= m < n
            return m - s
    else:
        return sympify(m)