code: def _get_frozen_trial(
      study: "optuna.Study", trial: Union[trial_module.Trial, int]
  ) -> FrozenTrial:
      if isinstance(trial, trial_module.Trial):
          trial_id = trial._trial_id
      elif isinstance(trial, int):
          trial_number = trial
          try:
              trial_id = study._storage.get_trial_id_from_study_id_trial_number(
                  study._study_id, trial_number
              )
          except KeyError as e:
              raise ValueError(
                  f"Cannot tell for trial with number {trial_number} since it has not been "
                  "created."
              ) from e
      else:
          raise TypeError(
              "Trial must be a trial object or trial number."
          )
  
      return study._storage.get_trial(trial_id)
  
file_path: optuna/optuna/study/_tell.py
imports: import copy
  import math
  from typing import Optional
  from typing import Sequence
  from typing import Union
  import warnings
  import optuna
  from optuna import logging
  from optuna import pruners
  from optuna import trial
  from optuna.trial import FrozenTrial
  from optuna.trial import TrialState
label_desc: Use image node_id 1 for calling a global function with example usage: _get_frozen_trial(study, trial) and returns: study