code: def _fni_input_validation(dist, tol, max_intervals):
      """
      Input validation and standardization for _fast_numerical_inverse.
  
      """
  
      has_pdf = hasattr(dist, "pdf") and callable(dist.pdf)
      has_cdf = hasattr(dist, "cdf") and callable(dist.cdf)
      has_ppf = hasattr(dist, "ppf") and callable(dist.ppf)
      has_isf = hasattr(dist, "isf") and callable(dist.isf)
  
      if not (has_pdf and has_cdf and has_ppf):
          raise ValueError(
              "`dist` must have methods `pdf`, `cdf`, and `ppf`."
          )
  
      if not has_isf:
  
          def isf(x):
              return 1 - dist.ppf(x)
  
          dist.isf = isf
  
      tol = float(tol)  # if there's an exception, raise it now
  
      if int(max_intervals) != max_intervals or max_intervals <= 1:
          raise ValueError(
              "`max_intervals' must be an integer greater than 1."
          )
  
      return dist, tol, max_intervals
  
file_path: catboost/contrib/python/scipy/py3/scipy/stats/_rvs_sampling.py
imports: import numpy
  from scipy._lib._util import check_random_state
  from scipy.interpolate import CubicHermiteSpline
  from scipy import stats
label_desc: Use image node_id 2 for calling a global function with example usage: _fni_input_validation(dist, tol, max_intervals) and returns: dist,  tol,  max_intervals, unknown