code: def _button(
      self,
      label: str,
      key: Optional[str],
      help: Optional[str],
      is_form_submitter: bool,
      on_click: Optional[WidgetCallback] = None,
      args: Optional[WidgetArgs] = None,
      kwargs: Optional[WidgetKwargs] = None,
      *,  # keyword-only arguments:
      type: Literal["primary", "secondary"] = "secondary",
      disabled: bool = False,
      use_container_width: bool = False,
      ctx: Optional[ScriptRunContext] = None,
  ) -> bool:
      if not is_form_submitter:
          check_callback_rules(self.dg, on_click)
      check_session_state_rules(
          default_value=None, key=key, writes_allowed=False
      )
  
      id = compute_widget_id(
          "button",
          user_key=key,
          label=label,
          key=key,
          help=help,
          is_form_submitter=is_form_submitter,
          type=type,
          use_container_width=use_container_width,
          page=ctx.page_script_hash if ctx else None,
      )
  
      # It doesn't make sense to create a button inside a form (except
      # for the "Form Submitter" button that's automatically created in
      # every form). We throw an error to warn the user about this.
      # We omit this check for scripts running outside streamlit, because
      # they will have no script_run_ctx.
      if runtime.exists():
          if is_in_form(self.dg) and not is_form_submitter:
              raise StreamlitAPIException(
                  f"`st.button()` can't be used in an `st.form()`.{FORM_DOCS_INFO}"
              )
          elif not is_in_form(self.dg) and is_form_submitter:
              raise StreamlitAPIException(
                  f"`st.form_submit_button()` must be used inside an `st.form()`.{FORM_DOCS_INFO}"
              )
  
      button_proto = ButtonProto()
      button_proto.id = id
      button_proto.label = label
      button_proto.default = False
      button_proto.is_form_submitter = is_form_submitter
      button_proto.form_id = current_form_id(self.dg)
      button_proto.type = type
      button_proto.use_container_width = use_container_width
      button_proto.disabled = disabled
  
      if help is not None:
          button_proto.help = dedent(help)
  
      serde = ButtonSerde()
  
      button_state = register_widget(
          "button",
          button_proto,
          user_key=key,
          on_change_handler=on_click,
          args=args,
          kwargs=kwargs,
          deserializer=serde.deserialize,
          serializer=serde.serialize,
          ctx=ctx,
      )
  
      self.dg._enqueue("button", button_proto)
  
      return button_state.value
  
imports: import io
  from dataclasses import dataclass
  from textwrap import dedent
  from typing import TYPE_CHECKING, BinaryIO, Optional, TextIO, Union, cast
  from typing_extensions import Final, Literal
  from streamlit import runtime
  from streamlit.elements.form import current_form_id, is_in_form
  from streamlit.elements.utils import check_callback_rules, check_session_state_rules
  from streamlit.errors import StreamlitAPIException
  from streamlit.proto.Button_pb2 import Button
  from streamlit.proto.DownloadButton_pb2 import DownloadButton
  from streamlit.proto.LinkButton_pb2 import LinkButton
  from streamlit.runtime.metrics_util import gather_metrics
  from streamlit.runtime.scriptrunner import ScriptRunContext, get_script_run_ctx
  from streamlit.runtime.state import WidgetArgs, WidgetCallback, WidgetKwargs, register_widget
  from streamlit.runtime.state.common import compute_widget_id
  from streamlit.type_util import Key, to_key
label_desc: Use image node_id 6 for calling the ButtonMixin obj's underlying member method code with example usage: obj._button(label, key, help, is_form_submitter, on_click, args, kwargs) and returns: button_state