code: def reverse_search_history(event: E) -> None:
      """
      Search backward starting at the current line and moving `up` through
      the history as necessary. This is an incremental search.
      """
      control = event.app.layout.current_control
  
      if (
          isinstance(control, BufferControl)
          and control.search_buffer_control
      ):
          event.app.current_search_state.direction = (
              SearchDirection.BACKWARD
          )
          event.app.layout.current_control = (
              control.search_buffer_control
          )
  
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 18 for calling a global function with example usage: reverse_search_history(event) without return types