code: def _score(estimator, X_test, y_test, scorer, is_multimetric=False):
      """
      Compute the score(s) of an estimator on a given test set. Will return
      a single float if is_multimetric is False and a dict of floats,
      if is_multimetric is True
      """
      if is_multimetric:
          return _multimetric_score(estimator, X_test, y_test, scorer)
      else:
          if y_test is None:
              score = scorer(estimator, X_test)
          else:
              score = scorer(estimator, X_test, y_test)
  
          if hasattr(score, "item"):
              try:
                  # e.g. unwrap memmapped scalars
                  score = score.item()
              except ValueError:
                  # non-scalar?
                  pass
  
          if not isinstance(score, numbers.Number):
              raise ValueError(
                  "scoring must return a number, got %s (%s) "
                  "instead. (scorer=%r)"
                  % (str(score), type(score), scorer)
              )
      return score
  
file_path: sk-dist/skdist/distribute/utils.py
imports: import numbers
  import numpy
  from sklearn.metrics import check_scoring
  from .validation import _safe_indexing
label_desc: Use image node_id 3 for calling a global function with example usage: _score(estimator, X_test, y_test, scorer, is_multimetric) and returns: score, _multimetric_score