code: def _check_solver_option(solver, multi_class, penalty, dual):
      if solver not in ["liblinear", "newton-cg", "lbfgs", "sag"]:
          raise ValueError(
              "Logistic Regression supports only liblinear,"
              " newton-cg, lbfgs and sag solvers, got %s" % solver
          )
  
      if multi_class not in ["multinomial", "ovr"]:
          raise ValueError(
              "multi_class should be either multinomial or "
              "ovr, got %s" % multi_class
          )
  
      if multi_class == "multinomial" and solver == "liblinear":
          raise ValueError(
              "Solver %s does not support "
              "a multinomial backend." % solver
          )
  
      if solver != "liblinear":
          if penalty != "l2":
              raise ValueError(
                  "Solver %s supports only l2 penalties, "
                  "got %s penalty." % (solver, penalty)
              )
          if dual:
              raise ValueError(
                  "Solver %s supports only "
                  "dual=False, got dual=%s" % (solver, dual)
              )
  
imports: import numbers
  import warnings
  import numpy
  from scipy import optimize, sparse
  from .base import LinearClassifierMixin, SparseCoefMixin, BaseEstimator
  from .sag import sag_solver
  from ..feature_selection.from_model import _LearntSelectorMixin
  from ..preprocessing import LabelEncoder, LabelBinarizer
  from ..svm.base import _fit_liblinear
  from ..utils import check_array, check_consistent_length, compute_class_weight
  from ..utils import check_random_state
  from ..utils.extmath import logsumexp, log_logistic, safe_sparse_dot, softmax, squared_norm
  from ..utils.extmath import row_norms
  from ..utils.optimize import newton_cg
  from ..utils.validation import check_X_y
  from ..exceptions import NotFittedError
  from ..utils.fixes import expit
  from ..utils.multiclass import check_classification_targets
  from ..externals.joblib import Parallel, delayed
  from ..model_selection import check_cv
  from ..externals import six
  from ..metrics import SCORERS
label_desc: Use image node_id 8 for calling a global function with example usage: _check_solver_option(solver, multi_class, penalty, dual) without return types