code: def check_predict_function_and_model_type(
      predict_function,
      model_type,
      model,
      data,
      model_class,
      model_info_,
      precalculate,
      verbose,
  ):
      if predict_function is None:
          # predict_function not specified
          # try the default
          (
              predict_function,
              model_type_,
          ) = get_predict_function_and_model_type(model, model_class)
  
          model_info_["predict_function_default"] = True
  
          if not predict_function:
              raise ValueError(
                  "  -> predict function  : 'predict_function' not provided and cannot be extracted."
              )
  
          verbose_cat(
              "  -> predict function  : "
              + str(predict_function)
              + " will be used (default)",
              verbose=verbose,
          )
      else:
          _, model_type_ = get_predict_function_and_model_type(
              model, model_class
          )
          model_info_["predict_function_default"] = False
          verbose_cat(
              "  -> predict function  : "
              + str(predict_function)
              + " will be used",
              verbose=verbose,
          )
  
      y_hat = None
      if data is not None:
          # check if predict_function accepts arrays
          try:
              data_values = data.values[[0]]
              predict_function(model, data_values)
              model_info_["arrays_accepted"] = True
              verbose_cat(
                  "  -> predict function  : Accepts pandas.DataFrame and numpy.ndarray.",
                  verbose=verbose,
              )
          except:
              model_info_["arrays_accepted"] = False
              verbose_cat(
                  "  -> predict function  : Accepts only pandas.DataFrame, numpy.ndarray causes problems.",
                  verbose=verbose,
              )
  
          if verbose or precalculate:
              try:
                  y_hat = predict_function(model, data)
                  verbose_cat(
                      str.format(
                          "  -> predicted values  : min = {0:.3}, mean = {1:.3}, max = {2:.3}",
                          np.min(y_hat).astype(float),
                          np.mean(y_hat).astype(float),
                          np.max(y_hat).astype(float),
                      ),
                      verbose=verbose,
                  )
  
              except (Exception, ValueError, TypeError) as error:
                  # verbose_cat("  -> predicted values  : the predict_function returns an error when executed \n",
                  #             verbose=verbose)
  
                  warn(
                      "\n  -> predicted values  : 'predict_function' returns an Error when executed: \n"
                      + str(error),
                      stacklevel=2,
                  )
  
              if not isinstance(y_hat, np.ndarray) or y_hat.shape != (
                  data.shape[0],
              ):
                  warn(
                      "\n  -> predicted values  : 'predict_function' must return numpy.ndarray (1d)",
                      stacklevel=2,
                  )
  
      if model_type is None:
          # model_type not specified
          if model_type_ is None:
              verbose_cat(
                  "  -> model type        : 'model_type' not provided and cannot be extracted.",
                  verbose=verbose,
              )
              verbose_cat(
                  "  -> model type        : Some functionalities won't be available.",
                  verbose=verbose,
              )
          else:
              # use extracted model_type
              model_type = model_type_
              model_info_["model_type_default"] = True
              verbose_cat(
                  "  -> model type        : "
                  + str(model_type)
                  + " will be used (default)",
                  verbose=verbose,
              )
      else:
          model_info_["model_type_default"] = False
          verbose_cat(
              "  -> model type        : "
              + str(model_type)
              + " will be used",
              verbose=verbose,
          )
  
      return predict_function, model_type, y_hat, model_info_
  
imports: import numpy
  import pandas
  from copy import deepcopy
  from warnings import warn
  from .helper import verbose_cat, is_y_in_data, get_model_info
  from .yhat import get_predict_function_and_model_type
label_desc: Use image node_id 9 for calling a global function with example usage: check_predict_function_and_model_type(predict_function, model_type, model, data, model_class, model_info_, precalculate, verbose) and returns: predict_function,  model_type,  y_hat,  model_info_