code: def match_model_to_data(model, data):
      if not isinstance(model, Model):
          raise TypeError("model must be of type Model!")
  
      try:
          if isinstance(data, DenseDataWithIndex):
              out_val = model.f(data.convert_to_df())
          else:
              out_val = model.f(data.data)
      except Exception:
          print(
              "Provided model function fails when applied to the provided data set."
          )
          raise
  
      if model.out_names is None:
          if len(out_val.shape) == 1:
              model.out_names = ["output value"]
          else:
              model.out_names = [
                  "output value " + str(i)
                  for i in range(out_val.shape[0])
              ]
  
      return out_val
  
imports: import copy
  import numpy
  import pandas
  import scipy.sparse
  from sklearn.cluster import KMeans
  from sklearn.impute import SimpleImputer
label_desc: Use image node_id 6 for calling a global function with example usage: match_model_to_data(model, data) and returns: out_val