code: def run_black(filename, wr_back, mode, report, fast):
      # black prints diff to stdout
      bb = io.BytesIO()
      stream = io.TextIOWrapper(
          buffer=bb,
          encoding=sys.stdout.encoding,
          write_through=True,
      )
  
      with collect_stdout(stream):
          black.reformat_one(
              Path(filename),
              fast=fast,
              write_back=wr_back,
              mode=mode,
              report=report,
          )
  
      return bb.getvalue().decode()
  
file_path: catboost/tools/black_linter/bin/__main__.py
imports: import contextlib
  import io
  import logging
  import os
  import sys
  import time
  from pathlib import Path
  import yalibrary.term.console
  from library.python.testing.custom_linter_util import linter_params, reporter
  import black
  import black.files
  import black.report
  import black.mode
label_desc: Use image node_id 2 for calling a global function with example usage: run_black(filename, wr_back, mode, report, fast) and returns: bb