def Solver(mats):
    """Return appropriate solver for `mats`

    Parameters
    ----------
    mats : SparseMatrix or list of SparseMatrices

    Returns
    -------
    Matrix solver (:class:`.SparseMatrixSolver`)

    Note
    ----
    The list of matrices may include boundary matrices. The returned solver
    will incorporate these boundary matrices automatically on the right hand
    side of the equation system.
    """
    assert isinstance(mats, (SparseMatrix, list))
    bc_mats = []
    mat = mats
    if isinstance(mats, list):
        bc_mats = extract_bc_matrices([mats])
        mat = sum(mats[1:], mats[0])
    return mat.get_solver()([mat]+bc_mats)