code: def plot_timeline(study: Study) -> "go.Figure":
      """Plot the timeline of a study.
  
      Example:
  
          The following code snippet shows how to plot the timeline of a study.
          Timeline plot can visualize trials with overlapping execution time
          (e.g., in distributed environments).
  
          .. plotly::
  
              import time
  
              import optuna
  
  
              def objective(trial):
                  x = trial.suggest_float("x", 0, 1)
                  time.sleep(x * 0.1)
                  if x > 0.8:
                      raise ValueError()
                  if x > 0.4:
                      raise optuna.TrialPruned()
                  return x ** 2
  
  
              study = optuna.create_study(direction="minimize")
              study.optimize(
                  objective, n_trials=50, n_jobs=2, catch=(ValueError,)
              )
  
              fig = optuna.visualization.plot_timeline(study)
              fig.show()
  
      Args:
          study:
              A :class:`~optuna.study.Study` object whose trials are plotted with
              their lifetime.
  
      Returns:
          A :class:`plotly.graph_objs.Figure` object.
      """
      _imports.check()
      info = _get_timeline_info(study)
      return _get_timeline_plot(info)
  
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 1 for calling a global function with example usage: plot_timeline(study) and returns: _get_timeline_plot