class_docstr: Format tokens as appropriate for a new testcase.
  
  .. versionadded:: 2.0
class_docstr_tok: ["Format","tokens","as","appropriate","for","a","new","testcase",".","..","versionadded",":",":","2.0"]
code: def format(self, tokensource, outfile):
      indentation = " " * 12
      rawbuf = []
      outbuf = []
      for ttype, value in tokensource:
          rawbuf.append(value)
          outbuf.append("%s(%s, %r),\n" % (indentation, ttype, value))
  
      before = TESTCASE_BEFORE % ("".join(rawbuf),)
      during = "".join(outbuf)
      after = TESTCASE_AFTER
      if self.encoding is None:
          outfile.write(before + during + after)
      else:
          outfile.write(before.encode("utf-8"))
          outfile.write(during.encode("utf-8"))
          outfile.write(after.encode("utf-8"))
      outfile.flush()
  
file_path: catboost/contrib/python/Pygments/py3/pygments/formatters/other.py
imports: from pygments.formatter import Formatter
  from pygments.util import get_choice_opt
  from pygments.token import Token
  from pygments.console import colorize
label_desc: Use image node_id 2 for calling the TestcaseFormatter obj's underlying member method code with example usage: obj.format(tokensource, outfile) without return types