code: def _get_widget(
      id: str, states: WidgetStates
  ) -> Optional[WidgetState]:
      """Return the widget with the given ID."""
      for state in states.widgets:
          if state.id == id:
              return state
      return None
  
imports: import unittest
  from typing import Optional
  from streamlit.proto.WidgetStates_pb2 import WidgetState, WidgetStates
  from streamlit.runtime.scriptrunner.script_requests import RerunData, ScriptRequest, ScriptRequests, ScriptRequestType
label_desc: Use image node_id 2 for calling a global function with example usage: _get_widget(id, states) and returns: None, state