code: def register_ipython_shortcuts(registry, shell):
      """Set up the prompt_toolkit keyboard shortcuts for IPython"""
      insert_mode = ViInsertMode() | EmacsInsertMode()
  
      # Ctrl+J == Enter, seemingly
      registry.add_binding(
          Keys.ControlJ,
          filter=(
              HasFocus(DEFAULT_BUFFER) & ~HasSelection() & insert_mode
          ),
      )(newline_or_execute_outer(shell))
  
      registry.add_binding(Keys.ControlBackslash)(force_exit)
  
      registry.add_binding(
          Keys.ControlP,
          filter=(ViInsertMode() & HasFocus(DEFAULT_BUFFER)),
      )(previous_history_or_previous_completion)
  
      registry.add_binding(
          Keys.ControlN,
          filter=(ViInsertMode() & HasFocus(DEFAULT_BUFFER)),
      )(next_history_or_next_completion)
  
      registry.add_binding(
          Keys.ControlG,
          filter=(HasFocus(DEFAULT_BUFFER) & HasCompletions()),
      )(dismiss_completion)
  
      registry.add_binding(
          Keys.ControlC, filter=HasFocus(DEFAULT_BUFFER)
      )(reset_buffer)
  
      registry.add_binding(
          Keys.ControlC, filter=HasFocus(SEARCH_BUFFER)
      )(reset_search_buffer)
  
      supports_suspend = Condition(
          lambda cli: hasattr(signal, "SIGTSTP")
      )
      registry.add_binding(Keys.ControlZ, filter=supports_suspend)(
          suspend_to_bg
      )
  
      # Ctrl+I == Tab
      registry.add_binding(
          Keys.ControlI,
          filter=(
              HasFocus(DEFAULT_BUFFER)
              & ~HasSelection()
              & insert_mode
              & cursor_in_leading_ws
          ),
      )(indent_buffer)
  
      registry.add_binding(
          Keys.ControlO,
          filter=(HasFocus(DEFAULT_BUFFER) & EmacsInsertMode()),
      )(newline_with_copy_margin)
  
      registry.add_binding(Keys.F2, filter=HasFocus(DEFAULT_BUFFER))(
          open_input_in_editor
      )
  
      if shell.display_completions == "readlinelike":
          registry.add_binding(
              Keys.ControlI,
              filter=(
                  HasFocus(DEFAULT_BUFFER)
                  & ~HasSelection()
                  & insert_mode
                  & ~cursor_in_leading_ws
              ),
          )(display_completions_like_readline)
  
      if sys.platform == "win32":
          registry.add_binding(
              Keys.ControlV,
              filter=(HasFocus(DEFAULT_BUFFER) & ~ViMode()),
          )(win_paste)
  
imports: import signal
  import sys
  from prompt_toolkit.enums import DEFAULT_BUFFER, SEARCH_BUFFER
  from prompt_toolkit.filters import HasFocus, HasSelection, Condition, ViInsertMode, EmacsInsertMode, HasCompletions
  from prompt_toolkit.filters.cli import ViMode
  from prompt_toolkit.keys import Keys
  from prompt_toolkit.key_binding.bindings.completion import display_completions_like_readline
  from IPython.utils.decorators import undoc
label_desc: Use image node_id 2 for calling a global function with example usage: register_ipython_shortcuts(registry, shell) without return types