code: def _calculate_model_cv_score_(
      df, target, feature, task, cross_validation, random_seed, **kwargs
  ):
      """Calculate the mean model score based on cross-validation."""
      # Sources about the used methods:
      # https://scikit-learn.org/stable/modules/tree.html
      # https://scikit-learn.org/stable/modules/cross_validation.html
      # https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.cross_val_score.html
      metric = task["metric_key"]
      model = task["model"]
      # shuffle the rows - this is important for cross-validation
      # because the cross-validation just takes the first n lines
      # if there is a strong pattern in the rows eg 0,0,0,0,1,1,1,1
      # then this will lead to problems because the first cv sees mostly 0 and the later 1
      # this approach might be wrong for timeseries because it might leak information
      df = df.sample(frac=1, random_state=random_seed, replace=False)
  
      # preprocess target
      if task["type"] == "classification":
          label_encoder = preprocessing.LabelEncoder()
          df[target] = label_encoder.fit_transform(df[target])
          target_series = df[target]
      else:
          target_series = df[target]
  
      # preprocess feature
      if _dtype_represents_categories(df[feature]):
          one_hot_encoder = preprocessing.OneHotEncoder()
          array = df[feature].__array__()
          sparse_matrix = one_hot_encoder.fit_transform(
              array.reshape(-1, 1)
          )
          feature_input = sparse_matrix
      else:
          # reshaping needed because there is only 1 feature
          array = df[feature].values
          if not isinstance(
              array, np.ndarray
          ):  # e.g Int64 IntegerArray
              array = array.to_numpy()
          feature_input = array.reshape(-1, 1)
  
      # Cross-validation is stratifiedKFold for classification, KFold for regression
      # CV on one core (n_job=1; default) has shown to be fastest
      scores = cross_val_score(
          model,
          feature_input,
          target_series,
          cv=cross_validation,
          scoring=metric,
      )
  
      return scores.mean()
  
imports: import warnings
  import numpy
  import pandas
  from pandas.api.types import is_bool_dtype, is_categorical_dtype, is_datetime64_any_dtype, is_numeric_dtype, is_object_dtype, is_string_dtype, is_timedelta64_dtype
  from sklearn import preprocessing, tree
  from sklearn.metrics import f1_score, mean_absolute_error
  from sklearn.model_selection import cross_val_score
  from deepchecks.utils.typing import Hashable
label_desc: Use image node_id 1 for calling a global function with example usage: _calculate_model_cv_score_(df, target, feature, task, cross_validation, random_seed) and returns: scores