code: def permutation_extractor(results, base_extractor):
      df = pd.concat(
          base_extractor(r)
          for r in results["permutation_importance"].values()
      )
      df.index = results["permutation_importance"].keys()
      if (
          "permutation_importance_baseline" in results
      ):  # With baseline comparison
          baseline = base_extractor(
              results["permutation_importance_baseline"]
          )
          baseline.index = ["baseline"]
          df = pd.concat((df, baseline))
          for c in baseline.columns:
              df[c + "_delta_from_baseline"] = (
                  baseline[c].iloc[0] - df[c]
              )
      return df
  
imports: import collections.abc
  from datetime import datetime
  from itertools import chain, repeat
  import pandas
  from toolz import curry
  from numpy import nan
label_desc: Use image node_id 17 for calling a global function with example usage: permutation_extractor(results, base_extractor) and returns: df