code: def _convert_tokens_to_string_with_added_encoders(
      tokenizer: Union[PreTrainedTokenizer, PreTrainedTokenizerFast],
      output_tokens: List[str],
      skip_special_tokens: bool,
      spaces_between_special_tokens: bool,
  ) -> str:
      # Adapted from
      # https://github.com/huggingface/transformers/blob/v4.28.0/src/transformers/tokenization_utils.py#L921
      # NOTE(woosuk): The following code is slow because it runs a for loop over
      # the output_tokens. In Python, running a for loop over a list can be slow
      # even when the loop body is very simple.
      sub_texts = []
      current_sub_text = []
      all_special_tokens = set(tokenizer.all_special_tokens)
      for token in output_tokens:
          if skip_special_tokens and token in all_special_tokens:
              continue
          if token in tokenizer.get_added_vocab():
              if current_sub_text:
                  sub_text = tokenizer.convert_tokens_to_string(
                      current_sub_text
                  )
                  sub_texts.append(sub_text)
                  current_sub_text = []
              sub_texts.append(token)
          else:
              current_sub_text.append(token)
      if current_sub_text:
          sub_text = tokenizer.convert_tokens_to_string(
              current_sub_text
          )
          sub_texts.append(sub_text)
      if spaces_between_special_tokens:
          return " ".join(sub_texts)
      else:
          return "".join(sub_texts)
  
imports: from typing import List, Optional, Tuple, Union
  from transformers import AutoTokenizer, PreTrainedTokenizer, PreTrainedTokenizerFast
  from bigdl.llm.vllm.logger import init_logger
  from bigdl.llm.utils.common import invalidInputError
label_desc: Use image node_id 2 for calling a global function with example usage: _convert_tokens_to_string_with_added_encoders(tokenizer, output_tokens, skip_special_tokens, spaces_between_special_tokens) and returns: str, str