code: def _build_duplicate_widget_message(
      widget_func_name: str, user_key: Optional[str] = None
  ) -> str:
      if user_key is not None:
          message = textwrap.dedent(
              """
              There are multiple widgets with the same `key='{user_key}'`.
  
              To fix this, please make sure that the `key` argument is unique for each
              widget you create.
              """
          )
      else:
          message = textwrap.dedent(
              """
              There are multiple identical `st.{widget_type}` widgets with the
              same generated key.
  
              When a widget is created, it's assigned an internal key based on
              its structure. Multiple widgets with an identical structure will
              result in the same internal key, which causes this error.
  
              To fix this error, please pass a unique `key` argument to
              `st.{widget_type}`.
              """
          )
  
      return message.strip("\n").format(
          widget_type=widget_func_name, user_key=user_key
      )
  
file_path: streamlit/lib/streamlit/runtime/state/widgets.py
imports: import textwrap
  from types import MappingProxyType
  from typing import TYPE_CHECKING, Dict, Mapping, Optional
  from typing_extensions import Final, TypeAlias
  from streamlit.errors import DuplicateWidgetID
  from streamlit.proto.WidgetStates_pb2 import WidgetState, WidgetStates
  from streamlit.runtime.state.common import RegisterWidgetResult, T, WidgetArgs, WidgetCallback, WidgetDeserializer, WidgetKwargs, WidgetMetadata, WidgetProto, WidgetSerializer, user_key_from_widget_id
  from streamlit.type_util import ValueFieldName
label_desc: Use image node_id 4 for calling a global function with example usage: _build_duplicate_widget_message(widget_func_name, user_key) and returns: message