code: def _convert(model, feature_names, target):
      spec = _Model_pb2.Model()
      spec.specificationVersion = SPECIFICATION_VERSION
  
      set_classifier_interface_params(
          spec,
          feature_names,
          model.classes_,
          "glmClassifier",
          output_features=target,
      )
  
      glmClassifier = spec.glmClassifier
  
      if model.multi_class == "ovr":
          glmClassifier.classEncoding = glmClassifier.OneVsRest
      else:
          print(
              '[ERROR] Currently "One Vs Rest" is the only supported multiclass option.'
          )
          return None
  
      glmClassifier.postEvaluationTransform = glmClassifier.Logit
  
      if isinstance(model.intercept_, Iterable):
          for val in model.intercept_:
              glmClassifier.offset.append(val)
      else:
          for _ in model.coef_:
              glmClassifier.offset.append(model.intercept_)
  
      for cur_in_row in model.coef_:
          cur_out_row = glmClassifier.weights.add()
          for val in cur_in_row:
              cur_out_row.value.append(val)
  
      return spec
  
file_path: coremltools/coremltools/converters/sklearn/_logistic_regression.py
imports: from collections.abc import Iterable
  from ..._deps import _HAS_SKLEARN
  from ...models import MLModel
  from ...None import SPECIFICATION_VERSION
  from ...models._interface_management import set_classifier_interface_params
  from ...proto import Model_pb2
label_desc: Use image node_id 2 for calling a global function with example usage: _convert(model, feature_names, target) and returns: spec, None