code: def pytest_configure(config: Config) -> None:
      if config.option.pastebin == "all":
          tr = config.pluginmanager.getplugin("terminalreporter")
          # If no terminal reporter plugin is present, nothing we can do here;
          # this can happen when this function executes in a worker node
          # when using pytest-xdist, for example.
          if tr is not None:
              # pastebin file will be UTF-8 encoded binary file.
              config.stash[pastebinfile_key] = tempfile.TemporaryFile(
                  "w+b"
              )
              oldwrite = tr._tw.write
  
              def tee_write(s, **kwargs):
                  oldwrite(s, **kwargs)
                  if isinstance(s, str):
                      s = s.encode("utf-8")
                  config.stash[pastebinfile_key].write(s)
  
              tr._tw.write = tee_write
  
file_path: catboost/contrib/python/pytest/py3/_pytest/pastebin.py
imports: import tempfile
  from io import StringIO
  from typing import IO
  from typing import Union
  import pytest
  from _pytest.config import Config
  from _pytest.config import create_terminal_writer
  from _pytest.config.argparsing import Parser
  from _pytest.stash import StashKey
  from _pytest.terminal import TerminalReporter
label_desc: Use image node_id 2 for calling a global function with example usage: pytest_configure(config) without return types