def check_eigen_solver(eigen_solver, solver_kwds, size=None, nvec=None):
if eigen_solver in BAD_EIGEN_SOLVERS:<EOL><INDENT>raise ValueError(BAD_EIGEN_SOLVERS[eigen_solver])<EOL><DEDENT>elif eigen_solver not in EIGEN_SOLVERS:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>".format(eigen_solver,<EOL>EIGEN_SOLVERS))<EOL><DEDENT>if size is not None and nvec is not None:<EOL><INDENT>if eigen_solver == '<STR_LIT>' and size < <NUM_LIT:5> * nvec + <NUM_LIT:1>:<EOL><INDENT>warnings.warn("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>eigen_solver = '<STR_LIT>'<EOL>solver_kwds = None<EOL><DEDENT>elif eigen_solver == '<STR_LIT>':<EOL><INDENT>if size > <NUM_LIT:200> and nvec < <NUM_LIT:10>:<EOL><INDENT>if PYAMG_LOADED:<EOL><INDENT>eigen_solver = '<STR_LIT>'<EOL>solver_kwds = None<EOL><DEDENT>else:<EOL><INDENT>eigen_solver = '<STR_LIT>'<EOL>solver_kwds = None<EOL><DEDENT><DEDENT>else:<EOL><INDENT>eigen_solver = '<STR_LIT>'<EOL>solver_kwds = None<EOL><DEDENT><DEDENT><DEDENT>return eigen_solver, solver_kwds<EOL>
Check that the selected eigensolver is valid

    Parameters
    ----------
    eigen_solver : string
        string value to validate
    size, nvec : int (optional)
        if both provided, use the specified problem size and number of vectors
        to determine the optimal method to use with eigen_solver='auto'

    Returns
    -------
    eigen_solver : string
        The eigen solver. This only differs from the input if
        eigen_solver == 'auto' and `size` is specified.