code: def _get_intermediate_plot_info(
      study: Study,
  ) -> _IntermediatePlotInfo:
      trials = study.get_trials(
          deepcopy=False,
          states=(
              TrialState.PRUNED,
              TrialState.COMPLETE,
              TrialState.RUNNING,
          ),
      )
  
      def _satisfies_constraints(trial: FrozenTrial) -> bool:
          constraints = trial.system_attrs.get(_CONSTRAINTS_KEY)
          return constraints is None or all(
              [x <= 0.0 for x in constraints]
          )
  
      trial_infos = [
          _TrialInfo(
              trial.number,
              sorted(trial.intermediate_values.items()),
              _satisfies_constraints(trial),
          )
          for trial in trials
          if len(trial.intermediate_values) > 0
      ]
  
      if len(trials) == 0:
          _logger.warning("Study instance does not contain trials.")
      elif len(trial_infos) == 0:
          _logger.warning(
              "You need to set up the pruning feature to utilize `plot_intermediate_values()`"
          )
  
      return _IntermediatePlotInfo(trial_infos)
  
file_path: optuna/optuna/visualization/_intermediate_values.py
imports: from __future__ import annotations
  from typing import NamedTuple
  from optuna.logging import get_logger
  from optuna.samplers._base import _CONSTRAINTS_KEY
  from optuna.study import Study
  from optuna.trial import FrozenTrial
  from optuna.trial import TrialState
  from optuna.visualization._plotly_imports import _imports
label_desc: Use image node_id 1 for calling a global function with example usage: _get_intermediate_plot_info(study) and returns: _IntermediatePlotInfo, unknown