def term_code(mu, nu, coef, matrix_form, rhouv_isconjugated, linear=True):
    r"""Get code to calculate a linear term.

    >>> term_code(1, 0, 33, False, False, True)
    '    rhs[1] += (33)*rho[0]\n'

    """
    if coef == 0:
        return ""
    coef = str(coef)

    # We change E_{0i} -> E0[i-1]
    ini = coef.find("E_{0")
    fin = coef.find("}")
    if ini != -1:
        l = int(coef[ini+4: fin])
        coef = coef[:ini]+"Ep["+str(l-1)+"]"+coef[fin+1:]

    # We change r[i, j] -> r[:, i, j]
    coef = coef.replace("rp[", "rp[:, ")
    coef = coef.replace("rm[", "rm[:, ")

    # We change symbolic complex-operations into fast numpy functions.
    coef = coef.replace("conjugate(", "np.conjugate(")
    coef = coef.replace("re(", "np.real(")
    coef = coef.replace("im(", "np.imag(")

    coef = coef.replace("*I", "j")

    if not linear:
        if matrix_form:
            s = "    b["+str(mu)+"] += "+coef+"\n"
        else:
            s = "    rhs["+str(mu)+"] += "+coef+"\n"
        return s

    # We add the syntax to calculate the term and store it in memory.
    s = "    "
    if matrix_form:
        s += "A["+str(mu)+", "+str(nu)+"] += "+coef+"\n"
    else:
        s += "rhs["+str(mu)+"] += ("+coef+")"
        if rhouv_isconjugated:
            s += "*np.conjugate(rho["+str(nu)+'])\n'
        else:
            s += "*rho["+str(nu)+']\n'

    return s
r"""Get code to calculate a linear term.

    >>> term_code(1, 0, 33, False, False, True)
    '    rhs[1] += (33)*rho[0]\n'