code: def _reduce_to_component_scope(
      state: AppState, component_name: str
  ) -> AppState:
      """Given the app state, this utility traverses down to the level of the given component name."""
      component_name_parts = component_name.split(".")[
          1:
      ]  # exclude root
      component_state = state
      for part in component_name_parts:
          component_state = getattr(component_state, part)
      return component_state
  
imports: import abc
  import inspect
  import os
  import pydoc
  import subprocess
  import sys
  from typing import Any, Callable, Type
  from lightning.app.core.work import LightningWork
  from lightning.app.utilities.app_helpers import StreamLitStatePlugin
  from lightning.app.utilities.state import AppState
label_desc: Use image node_id 1 for calling a global function with example usage: _reduce_to_component_scope(state, component_name) and returns: component_state