code: def insert_comment(event: E) -> None:
      """
      Without numeric argument, comment all lines.
      With numeric argument, uncomment all lines.
      In any case accept the input.
      """
      buff = event.current_buffer
  
      # Transform all lines.
      if event.arg != 1:
  
          def change(line: str) -> str:
              return line[1:] if line.startswith("#") else line
  
      else:
  
          def change(line: str) -> str:
              return "#" + line
  
      buff.document = Document(
          text="\n".join(map(change, buff.text.splitlines())),
          cursor_position=0,
      )
  
      # Accept input.
      buff.validate_and_handle()
  
imports: from __future__ import annotations
  from typing import Callable, TypeVar, Union, cast
  from prompt_toolkit.document import Document
  from prompt_toolkit.enums import EditingMode
  from prompt_toolkit.key_binding.key_bindings import Binding, key_binding
  from prompt_toolkit.key_binding.key_processor import KeyPress, KeyPressEvent
  from prompt_toolkit.keys import Keys
  from prompt_toolkit.layout.controls import BufferControl
  from prompt_toolkit.search import SearchDirection
  from prompt_toolkit.selection import PasteMode
  from .completion import display_completions_like_readline, generate_completions
label_desc: Use image node_id 46 for calling a global function with example usage: insert_comment(event) and returns: unknown, unknown