code: def print_tokens(output, tokens, style):
      """
      Print a list of (Token, text) tuples in the given style to the output.
      """
      assert isinstance(output, Output)
      assert isinstance(style, Style)
  
      # Reset first.
      output.reset_attributes()
      output.enable_autowrap()
  
      # Print all (token, text) tuples.
      attrs_for_token = _TokenToAttrsCache(style.get_attrs_for_token)
  
      for token, text in tokens:
          attrs = attrs_for_token[token]
  
          if attrs:
              output.set_attributes(attrs)
          else:
              output.reset_attributes()
  
          output.write(text)
  
      # Reset again.
      output.reset_attributes()
      output.flush()
  
imports: from __future__ import unicode_literals
  from prompt_toolkit.filters import to_cli_filter
  from prompt_toolkit.layout.mouse_handlers import MouseHandlers
  from prompt_toolkit.layout.screen import Point, Screen, WritePosition
  from prompt_toolkit.output import Output
  from prompt_toolkit.styles import Style
  from prompt_toolkit.token import Token
  from prompt_toolkit.utils import is_windows
  from six.moves import range
label_desc: Use image node_id 2 for calling a global function with example usage: print_tokens(output, tokens, style) without return types