code: def _parse_hierarchy(hierarchy_str):  # pylint: disable = invalid-name
      """Parse hierarchy for Hourglass definition."""
      levels = hierarchy_str.split(" ")
      if levels != levels[::-1]:
          raise ValueError("Hierarchy is not a palindrome")
      layer_level_pairs = [
          (x.split("@")) for x in levels[: 1 + (len(levels) // 2)]
      ]
      hierarchy_n_layers = [int(x[0]) for x in layer_level_pairs]
      total_sf_per_level = [int(x[1]) for x in layer_level_pairs]
  
      hierarchy_shorten_factors = []
      for current_sf, prev_sf in zip(
          total_sf_per_level, [1] + total_sf_per_level[:-1]
      ):
          if current_sf % prev_sf != 0:
              raise ValueError(
                  f"Hierarchy not divisible by previous level: {current_sf}, {prev_sf}"
              )
          hierarchy_shorten_factors.append(current_sf // prev_sf)
  
      return hierarchy_n_layers, hierarchy_shorten_factors
  
file_path: trax/trax/models/research/hourglass.py
imports: import trax.layers
  from trax.layers.research.rel_attention import get_rel_att_inputs
  from trax.layers.research.rel_attention import RelativeAttentionWrapper
  from trax.layers.research.resampling import AttentionResampling
  from trax.layers.research.resampling import AveragePooling
  from trax.layers.research.resampling import FeedForwardBlock
  from trax.layers.research.resampling import LinearUpsampling
  from trax.models.research.configurable_transformer import ApplyAttentionLayer
label_desc: Use image node_id 2 for calling a global function with example usage: _parse_hierarchy(hierarchy_str) and returns: hierarchy_n_layers,  hierarchy_shorten_factors