code: def cost_fig(cost_data, plot_height, plot_width, epoch_axis=True):
      """
      Generate a figure with lines for each element in cost_data.
  
      Arguments:
          cost_data (list): Cost data to plot
          plot_height (int): Plot height
          plot_width (int): Plot width
          epoch_axis (bool, optional): If true, use Epoch, if false use Minibatch
  
      Returns:
          bokeh.plotting.figure: cost_data figure
      """
  
      fig = figure(
          plot_height=plot_height,
          plot_width=plot_width,
          title="Cost",
          x_axis_label=x_label(epoch_axis),
          y_axis_label="Cross Entropy Error (%)",
      )
  
      # Spectral palette supports 3 - 11 distinct colors
      num_colors_required = len(cost_data)
      assert (
          num_colors_required <= 11
      ), "Insufficient colors in predefined palette."
      colors = list(brewer["Spectral"][max(3, len(cost_data))])
      if num_colors_required < 3:
          # manually adjust pallette for better contrast
          colors[0] = brewer["Spectral"][6][0]
          if num_colors_required == 2:
              colors[1] = brewer["Spectral"][6][-1]
  
      for name, x, y in cost_data:
          fig.line(x, y, legend=name, color=colors.pop(0), line_width=2)
      return fig
  
label_desc: Use image node_id 2 for calling a global function with example usage: cost_fig(cost_data, plot_height, plot_width, epoch_axis) and returns: fig