code: def compute_n_splits(cv, X, y=None, groups=None):
      
      if not any(is_dask_collection(i) for i in (X, y, groups)):
          return cv.get_n_splits(X, y, groups)
  
      if isinstance(cv, (_BaseKFold, BaseShuffleSplit)):
          return cv.n_splits
  
      elif isinstance(cv, PredefinedSplit):
          return len(cv.unique_folds)
  
      elif isinstance(cv, _CVIterableWrapper):
          return len(cv.cv)
  
      elif isinstance(cv, (LeaveOneOut, LeavePOut)) and not is_dask_collection(X):
          # Only `X` is referenced for these classes
          return cv.get_n_splits(X, None, None)
  
      elif isinstance(cv, (LeaveOneGroupOut, LeavePGroupsOut)) and not is_dask_collection(
          groups
      ):
          # Only `groups` is referenced for these classes
          return cv.get_n_splits(None, None, groups)
  
      else:
          return delayed(cv).get_n_splits(X, y, groups).compute()
docs: Return the number of splits.
  
      Parameters
      ----------
      cv : BaseCrossValidator
      X, y, groups : array_like, dask object, or None
  
      Returns
      -------
      n_splits : int