code: def _select_and_clip_prob(cdfprob, sfprob, cdf=True):
      """Selects either the CDF or SF, and then clips to range 0<=p<=1."""
      p = np.where(cdf, cdfprob, sfprob)
      return _clip_prob(p)
  
file_path: scipy/scipy/stats/_ksstats.py
imports: import numpy
  import scipy.special
  import scipy.special._ufuncs
  from scipy._lib._finite_differences import _derivative
label_desc: Use image node_id 3 for calling a global function with example usage: _select_and_clip_prob(cdfprob, sfprob, cdf) and returns: _clip_prob