code: def _prf_divide(
      numerator,
      denominator,
      metric,
      modifier,
      average,
      warn_for,
      zero_division="warn",
  ):
      """Performs division and handles divide-by-zero.
  
      On zero-division, sets the corresponding result elements equal to
      0, 1 or np.nan (according to ``zero_division``). Plus, if
      ``zero_division != "warn"`` raises a warning.
  
      The metric, modifier and average arguments are used only for determining
      an appropriate warning.
      """
      mask = denominator == 0.0
      denominator = denominator.copy()
      denominator[mask] = 1  # avoid infs/nans
      result = numerator / denominator
  
      if not np.any(mask):
          return result
  
      # set those with 0 denominator to `zero_division`, and 0 when "warn"
      zero_division_value = _check_zero_division(zero_division)
      result[mask] = zero_division_value
  
      # we assume the user will be removing warnings if zero_division is set
      # to something different than "warn". If we are computing only f-score
      # the warning will be raised only if precision and recall are ill-defined
      if zero_division != "warn" or metric not in warn_for:
          return result
  
      # build appropriate warning
      # E.g. "Precision and F-score are ill-defined and being set to 0.0 in
      # labels with no predicted samples. Use ``zero_division`` parameter to
      # control this behavior."
  
      if metric in warn_for and "f-score" in warn_for:
          msg_start = "{0} and F-score are".format(metric.title())
      elif metric in warn_for:
          msg_start = "{0} is".format(metric.title())
      elif "f-score" in warn_for:
          msg_start = "F-score is"
      else:
          return result
  
      _warn_prf(average, modifier, msg_start, len(result))
  
      return result
  
imports: import warnings
  from numbers import Integral, Real
  import numpy
  from scipy.sparse import coo_matrix, csr_matrix
  from scipy.special import xlogy
  from ..exceptions import UndefinedMetricWarning
  from ..preprocessing import LabelBinarizer, LabelEncoder
  from ..utils import assert_all_finite, check_array, check_consistent_length, column_or_1d
  from ..utils._param_validation import Interval, Options, StrOptions, validate_params
  from ..utils.extmath import _nanaverage
  from ..utils.multiclass import type_of_target, unique_labels
  from ..utils.sparsefuncs import count_nonzero
  from ..utils.validation import _check_pos_label_consistency, _num_samples
label_desc: Use image node_id 13 for calling a global function with example usage: _prf_divide(numerator, denominator, metric, modifier, average, warn_for, zero_division) and returns: result, result, result, result