code: def assert_regrets_plot(plot, names, balanced=10, with_avg=False):
      """Checks the layout of a regrets plot"""
      assert plot.layout.title.text == "Average Regret"
      assert (
          plot.layout.xaxis.title.text
          == "Trials ordered by suggested time"
      )
      assert plot.layout.yaxis.title.text == "loss"
  
      if with_avg:
          line_plots = plot.data[::2]
          err_plots = plot.data[1::2]
      else:
          line_plots = plot.data
  
      assert len(line_plots) == len(names)
  
      for name, trace in zip(names, line_plots):
          assert trace.type == "scatter"
          assert trace.name == name
          assert trace.mode == "lines+markers"
          if balanced:
              assert len(trace.y) == balanced
              assert len(trace.x) == balanced
  
      if with_avg:
          assert len(err_plots) == len(names)
          for name, trace in zip(names, err_plots):
              assert trace.fill == "toself"
              assert trace.name == name
              assert not trace.showlegend
              if balanced:
                  assert len(trace.y) == balanced * 2
                  assert len(trace.x) == balanced * 2
  
file_path: orion/src/orion/testing/plotting.py
label_desc: Use image node_id 2 for calling a global function with example usage: assert_regrets_plot(plot, names, balanced, with_avg) without return types