code: def _get_current_rung(trial: "optuna.trial.FrozenTrial") -> int:
      # The following loop takes `O(log step)` iterations.
      rung = 0
      while _completed_rung_key(rung) in trial.system_attrs:
          rung += 1
      return rung
  
file_path: optuna/optuna/pruners/_successive_halving.py
imports: import math
  from typing import List
  from typing import Optional
  from typing import Union
  import optuna
  from optuna.pruners._base import BasePruner
  from optuna.study._study_direction import StudyDirection
  from optuna.trial._state import TrialState
label_desc: Use image node_id 2 for calling a global function with example usage: _get_current_rung(trial) and returns: rung