code: def _get_timeline_info(study: Study) -> _TimelineInfo:
      bars = []
      for t in study.get_trials(deepcopy=False):
          date_complete = t.datetime_complete or datetime.datetime.now()
          date_start = t.datetime_start or date_complete
          infeasible = (
              False
              if _CONSTRAINTS_KEY not in t.system_attrs
              else any(
                  [x > 0 for x in t.system_attrs[_CONSTRAINTS_KEY]]
              )
          )
          if date_complete < date_start:
              _logger.warning(
                  (
                      f"The start and end times for Trial {t.number} seem to be reversed. "
                      f"The start time is {date_start} and the end time is {date_complete}."
                  )
              )
          bars.append(
              _TimelineBarInfo(
                  number=t.number,
                  start=date_start,
                  complete=date_complete,
                  state=t.state,
                  hovertext=_make_hovertext(t),
                  infeasible=infeasible,
              )
          )
  
      if len(bars) == 0:
          _logger.warning("Your study does not have any trials.")
  
      return _TimelineInfo(bars)
  
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 2 for calling a global function with example usage: _get_timeline_info(study) and returns: _TimelineInfo