class_docstr: A lightweight wrapper of a dict that sends forwardMsgs when state changes.
  It stores str keys with str and List[str] values.
class_docstr_tok: ["A","lightweight","wrapper","of","a","dict","that","sends","forwardMsgs","when","state","changes",".","It","stores","str","keys","with","str","and","List","[","str","]","values","."]
docstr: Retrieves a value for a given key in query parameters.
  Returns the last item in a list or an empty string if empty.
  If the key is not present, raise KeyError.
docstr_tok: ["Retrieves","a","value","for","a","given","key","in","query","parameters",".","Returns","the","last","item","in","a","list","or","an","empty","string","if","empty",".","If","the","key","is","not","present",",","raise","KeyError","."]
code: def __getitem__(self, key: str) -> str:
      """Retrieves a value for a given key in query parameters.
      Returns the last item in a list or an empty string if empty.
      If the key is not present, raise KeyError.
      """
      self._ensure_single_query_api_used()
      try:
          if key in EMBED_QUERY_PARAMS_KEYS:
              raise KeyError(missing_key_error_message(key))
          value = self._query_params[key]
          if isinstance(value, list):
              if len(value) == 0:
                  return ""
              else:
                  # Return the last value to mimic Tornado's behavior
                  # https://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.get_query_argument
                  return value[-1]
          return value
      except KeyError:
          raise KeyError(missing_key_error_message(key))
  
imports: from dataclasses import dataclass, field
  from typing import Dict, Iterable, Iterator, List, MutableMapping, Union
  from urllib import parse
  from streamlit.constants import EMBED_QUERY_PARAMS_KEYS
  from streamlit.errors import StreamlitAPIException
  from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
label_desc: Use image node_id 2 for calling the QueryParams obj's underlying member method code with example usage: obj.__getitem__(key) and returns: value, str, value