class_docstr: Format tokens with ANSI color sequences, for output in a 256-color
  terminal or console.  Like in `TerminalFormatter` color sequences
  are terminated at newlines, so that paging the output works correctly.
  
  The formatter takes colors from a style defined by the `style` option
  and converts them to nearest ANSI 256-color escape sequences. Bold and
  underline attributes from the style are preserved (and displayed).
  
  .. versionadded:: 0.9
  
  .. versionchanged:: 2.2
     If the used style defines foreground colors in the form ``#ansi*``, then
     `Terminal256Formatter` will map these to non extended foreground color.
     See :ref:`AnsiTerminalStyle` for more information.
  
  Options accepted:
  
  `style`
      The style to use, can be a string or a Style subclass (default:
      ``'default'``).
class_docstr_tok: ["Format","tokens","with","ANSI","color","sequences",",","for","output","in","a","256-color","terminal","or","console",".","Like","in","`","TerminalFormatter","`","color","sequences","are","terminated","at","newlines",",","so","that","paging","the","output","works","correctly",".","The","formatter","takes","colors","from","a","style","defined","by","the","`","style","`","option","and","converts","them","to","nearest","ANSI","256-color","escape","sequences",".","Bold","and","underline","attributes","from","the","style","are","preserved","(","and","displayed",")",".","..","versionadded",":",":","0.9","..","versionchanged",":",":","2.2","If","the","used","style","defines","foreground","colors","in","the","form","``","#","ansi","*","``",",","then","`","Terminal256Formatter","`","will","map","these","to","non","extended","foreground","color",".","See",":","ref",":","`","AnsiTerminalStyle","`","for","more","information",".","Options","accepted",":","`","style","`","The","style","to","use",",","can","be","a","string","or","a","Style","subclass","(","default",":","``","'default","'","``",")","."]
code: def format_unencoded(self, tokensource, outfile):
      for ttype, value in tokensource:
          not_found = True
          while ttype and not_found:
              try:
                  # outfile.write( "<" + str(ttype) + ">" )
                  on, off = self.style_string[str(ttype)]
  
                  # Like TerminalFormatter, add "reset colors" escape sequence
                  # on newline.
                  spl = value.split("\n")
                  for line in spl[:-1]:
                      if line:
                          outfile.write(on + line + off)
                      outfile.write("\n")
                  if spl[-1]:
                      outfile.write(on + spl[-1] + off)
  
                  not_found = False
                  # outfile.write( '#' + str(ttype) + '#' )
  
              except KeyError:
                  # ottype = ttype
                  ttype = ttype[:-1]
                  # outfile.write( '!' + str(ottype) + '->' + str(ttype) + '!' )
  
          if not_found:
              outfile.write(value)
  
imports: import sys
  from pygments.formatter import Formatter
  from pygments.console import codes
  from pygments.style import ansicolors
label_desc: Use image node_id 7 for calling the Terminal256Formatter obj's underlying member method code with example usage: obj.format_unencoded(tokensource, outfile) without return types