code: def get_common_complete_suffix(
      document: Document, completions: Sequence[Completion]
  ) -> str:
      """
      Return the common prefix for all completions.
      """
  
      # Take only completions that don't change the text before the cursor.
      def doesnt_change_before_cursor(completion: Completion) -> bool:
          end = completion.text[: -completion.start_position]
          return document.text_before_cursor.endswith(end)
  
      completions2 = [
          c for c in completions if doesnt_change_before_cursor(c)
      ]
  
      # When there is at least one completion that changes the text before the
      # cursor, don't return any common part.
      if len(completions2) != len(completions):
          return ""
  
      # Return the common prefix.
      def get_suffix(completion: Completion) -> str:
          return completion.text[-completion.start_position :]
  
      return _commonprefix([get_suffix(c) for c in completions2])
  
imports: from __future__ import annotations
  from abc import ABCMeta, abstractmethod
  from typing import AsyncGenerator, Callable, Iterable, Sequence
  from prompt_toolkit.document import Document
  from prompt_toolkit.eventloop import aclosing, generator_to_async_generator
  from prompt_toolkit.filters import FilterOrBool, to_filter
  from prompt_toolkit.formatted_text import AnyFormattedText, StyleAndTextTuples
label_desc: Use image node_id 2 for calling a global function with example usage: get_common_complete_suffix(document, completions) and returns: _commonprefix, document, str, completion