code: def read_results(file_path):
      """reads experiment result data from a '.m' file
      :file_path: the path to the file
      :returns: a dataframe object with all the various pieces of data
  
      """
      if file_path.endswith(".mat"):
          results = loadmat(file_path)
      elif file_path.endswith(".p"):
          with open(file_path, "rb") as pickleF:
              res = pickle.load(pickleF)
              pickleF.close()
  
          results = {}
          for key in list(res.keys()):
              if not hasattr(res[key], "__len__"):
                  results[key] = np.array(res[key])
              elif isinstance(res[key], str):
                  results[key] = np.array(res[key])
              elif isinstance(res[key], list):
                  results[key] = np.array(res[key])
              elif isinstance(res[key], np.ndarray):
                  val = np.zeros(res[key].shape, dtype=res[key].dtype)
                  for idx, x in np.ndenumerate(res[key]):
                      if isinstance(x, list):
                          val[idx] = np.array(x)
                      else:
                          val[idx] = x
                  results[key] = val
              else:
                  results[key] = res[key]
      else:
          raise ValueError(
              "Wrong file format. It has to be either mat or pickle file"
          )
      return results
  
file_path: dragonfly/dragonfly/utils/plot_utils.py
imports: from __future__ import division
  import pickle
  import argparse
  import matplotlib.pyplot
  import matplotlib
  from scipy.io import loadmat
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: read_results(file_path) and returns: results