code: def test_plot_intermediate_values(
      plotter: Callable[[_IntermediatePlotInfo], Any],
      info: _IntermediatePlotInfo,
  ) -> None:
      figure = plotter(info)
      if isinstance(figure, go.Figure):
          figure.write_image(BytesIO())
      else:
          plt.savefig(BytesIO())
          plt.close()
  
file_path: optuna/tests/visualization_tests/test_intermediate_plot.py
imports: from io import BytesIO
  from typing import Any
  from typing import Callable
  from typing import Sequence
  import pytest
  from optuna.study import create_study
  from optuna.testing.objectives import fail_objective
  from optuna.trial import FrozenTrial
  from optuna.trial import Trial
  import optuna.visualization._intermediate_values
  from optuna.visualization._intermediate_values import _get_intermediate_plot_info
  from optuna.visualization._intermediate_values import _IntermediatePlotInfo
  from optuna.visualization._intermediate_values import _TrialInfo
  from optuna.visualization._plotly_imports import go
  import optuna.visualization.matplotlib._intermediate_values
  from optuna.visualization.matplotlib._matplotlib_imports import plt
label_desc: Use image node_id 2 for calling a global function with example usage: test_plot_intermediate_values(plotter, info) without return types