code: def _check_threshold(threshold):
      """Accept a float or a string that ends with %."""
      _validate_type(threshold, ("numeric", str), "threshold")
      if isinstance(threshold, str):
          if not threshold.endswith("%"):
              raise ValueError(
                  "Threshold if a string must end with "
                  '"%%". Got %s.' % threshold
              )
          threshold = float(threshold[:-1]) / 100.0
      threshold = float(threshold)
      if not 0 <= threshold <= 1:
          raise ValueError(
              "Threshold proportion must be between 0 and 1 (inclusive), but "
              f"got {threshold}"
          )
      return threshold
  
imports: from functools import partial
  import numpy
  from scipy.spatial.distance import cdist
  from ...utils import _check_option, _validate_type, fill_doc
label_desc: Use image node_id 8 for calling a global function with example usage: _check_threshold(threshold) and returns: threshold