code: def _get_timeline_plot(info: _TimelineInfo) -> "go.Figure":
      _cm = {
          "COMPLETE": "blue",
          "FAIL": "red",
          "PRUNED": "orange",
          "RUNNING": "green",
          "WAITING": "gray",
      }
  
      fig = go.Figure()
      for s in sorted(TrialState, key=lambda x: x.name):
          if s.name == "COMPLETE":
              infeasible_bars = [
                  b for b in info.bars if b.state == s and b.infeasible
              ]
              feasible_bars = [
                  b
                  for b in info.bars
                  if b.state == s and not b.infeasible
              ]
              _plot_bars(infeasible_bars, "#cccccc", "INFEASIBLE", fig)
              _plot_bars(feasible_bars, _cm[s.name], s.name, fig)
          else:
              bars = [b for b in info.bars if b.state == s]
              _plot_bars(bars, _cm[s.name], s.name, fig)
      fig.update_xaxes(type="date")
      fig.update_layout(
          go.Layout(
              title="Timeline Plot",
              xaxis={"title": "Datetime"},
              yaxis={"title": "Trial"},
          )
      )
      fig.update_layout(
          showlegend=True
      )  # Draw a legend even if all TrialStates are the same.
      return fig
  
file_path: optuna/optuna/visualization/_timeline.py
imports: from __future__ import annotations
  import datetime
  from typing import NamedTuple
  from optuna._experimental import experimental_func
  from optuna.logging import get_logger
  from optuna.samplers._base import _CONSTRAINTS_KEY
  from optuna.study import Study
  from optuna.trial import TrialState
  from optuna.visualization._plotly_imports import _imports
  from optuna.visualization._utils import _make_hovertext
label_desc: Use image node_id 3 for calling a global function with example usage: _get_timeline_plot(info) and returns: fig