Generate and return QuTiP representation matrices for the Hamiltonian
    and the collapse operators. Any inhomogeneities in the Lindblad operators
    (resulting from coherent drives) will be moved into the Hamiltonian, cf.
    :func:`~qnet.algebra.circuit_algebra.move_drive_to_H`.

    Args:
        slh (SLH): The SLH object from which to generate the qutip data
        full_space (HilbertSpace or None): The Hilbert space in which to
            represent the operators. If None, the space of `shl` will be used
        time_symbol (:class:`sympy.Symbol` or None): The symbol (if any)
            expressing time dependence (usually 't')
        convert_as (str): How to express time dependencies to qutip. Must be
            'pyfunc' or 'str'

    Returns:
        tuple ``(H, [L1, L2, ...])`` as numerical `qutip.Qobj` representations,
        where ``H`` and each ``L`` may be a nested list to express time
        dependence, e.g.  ``H = [H0, [H1, eps_t]]``, where ``H0`` and
        ``H1`` are of type `qutip.Qobj`, and ``eps_t`` is either a string
        (``convert_as='str'``) or a function (``convert_as='pyfunc'``)

    Raises:
        AlgebraError: If the Hilbert space (`slh.space` or `full_space`) is
            invalid for numerical conversion

def SLH_to_qutip(slh, full_space=None, time_symbol=None,
                 convert_as='pyfunc'):
    """Generate and return QuTiP representation matrices for the Hamiltonian
    and the collapse operators. Any inhomogeneities in the Lindblad operators
    (resulting from coherent drives) will be moved into the Hamiltonian, cf.
    :func:`~qnet.algebra.circuit_algebra.move_drive_to_H`.

    Args:
        slh (SLH): The SLH object from which to generate the qutip data
        full_space (HilbertSpace or None): The Hilbert space in which to
            represent the operators. If None, the space of `shl` will be used
        time_symbol (:class:`sympy.Symbol` or None): The symbol (if any)
            expressing time dependence (usually 't')
        convert_as (str): How to express time dependencies to qutip. Must be
            'pyfunc' or 'str'

    Returns:
        tuple ``(H, [L1, L2, ...])`` as numerical `qutip.Qobj` representations,
        where ``H`` and each ``L`` may be a nested list to express time
        dependence, e.g.  ``H = [H0, [H1, eps_t]]``, where ``H0`` and
        ``H1`` are of type `qutip.Qobj`, and ``eps_t`` is either a string
        (``convert_as='str'``) or a function (``convert_as='pyfunc'``)

    Raises:
        AlgebraError: If the Hilbert space (`slh.space` or `full_space`) is
            invalid for numerical conversion
    """
    if full_space:
        if not full_space >= slh.space:
            raise AlgebraError("full_space="+str(full_space)+" needs to "
                               "at least include slh.space = "+str(slh.space))
    else:
        full_space = slh.space
    if full_space == TrivialSpace:
        raise AlgebraError(
            "Cannot convert SLH object in TrivialSpace. "
            "You may pass a non-trivial `full_space`")
    slh = move_drive_to_H(slh)
    if time_symbol is None:
        H = convert_to_qutip(slh.H, full_space=full_space)
        Ls = []
        for L in slh.Ls:
            if is_scalar(L):
                L = L * IdentityOperator
            L_qutip = convert_to_qutip(L, full_space=full_space)
            if L_qutip.norm('max') > 0:
                Ls.append(L_qutip)
    else:
        H = _time_dependent_to_qutip(slh.H, full_space, time_symbol,
                                     convert_as)
        Ls = []
        for L in slh.Ls:
            if is_scalar(L):
                L = L * IdentityOperator
            L_qutip = _time_dependent_to_qutip(L, full_space, time_symbol,
                                               convert_as)
            Ls.append(L_qutip)
    return H, Ls