code: def extract_history(solvers, x, y, given_labels):
      x_arrays = []
      y_arrays = []
      labels = []
      for i, solver in enumerate(solvers):
          if isinstance(solver, LearnerOptim):
              history = solver._solver_obj.history
              label = solver._solver_obj.name
          elif isinstance(solver, Solver):
              history = solver.history
              label = solver.name
          else:
              raise ValueError(
                  "%s has no history" % solver.__class__.__name__
              )
  
          # if label was given we override it
          if given_labels is not None and i < len(given_labels):
              label = given_labels[i]
  
          if x not in history.values.keys():
              raise ValueError("%s has no history for %s" % (label, x))
  
          elif y not in history.values.keys():
              raise ValueError("%s has no history for %s" % (label, y))
          else:
              x_arrays.append(np.array(history.values[x]))
              y_arrays.append(np.array(history.values[y]))
              labels.append(label)
  
      return x_arrays, y_arrays, labels
  
imports: import matplotlib.pyplot
  import numpy
  from tick.base.learner import LearnerOptim
  from tick.plot.plot_utilities import get_plot_color
  from tick.solver.base import Solver
label_desc: Use image node_id 1 for calling a global function with example usage: extract_history(solvers, x, y, given_labels) and returns: x_arrays,  y_arrays,  labels