code: def _check_state_and_values(
      state: Optional[TrialState],
      values: Optional[Union[float, Sequence[float]]],
  ) -> None:
      if state == TrialState.COMPLETE:
          if values is None:
              raise ValueError(
                  "No values were told. Values are required when state is TrialState.COMPLETE."
              )
      elif state in (TrialState.PRUNED, TrialState.FAIL):
          if values is not None:
              raise ValueError(
                  "Values were told. Values cannot be specified when state is "
                  "TrialState.PRUNED or TrialState.FAIL."
              )
      elif state is not None:
          raise ValueError(f"Cannot tell with state {state}.")
  
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 2 for calling a global function with example usage: _check_state_and_values(state, values) without return types