code: def feature_importance(x, y, func, repeat=10, plot=True):
      base_score = func(x, y)
      imp = [0] * len(x.columns)
      for i in range(repeat):
          for j, c in enumerate(x.columns):
              tmp = x[c].values.copy()
              np.random.shuffle(x[c].values)
              score = func(x, y)
              x[c] = tmp
              imp[j] += base_score - score
      imp = [a / repeat for a in imp]
      imp_df = pd.DataFrame(data=[imp], columns=x.columns)
      if plot:
          imp_df.sum().sort_values().plot.barh()
      return imp_df
  
imports: import pandas
  import matplotlib.pyplot
  import numpy
  from scipy.stats import spearmanr
  from scipy.cluster import hierarchy
  from typing import List, Any, Union, Tuple, Optional, Dict
  import random, math
  from sklearn.metrics import roc_curve, precision_recall_curve, roc_auc_score, confusion_matrix
  import itertools
  import logging
label_desc: Use image node_id 20 for calling a global function with example usage: feature_importance(x, y, func, repeat, plot) and returns: imp_df