code: def get_stderr_fileno() -> int:
      try:
          fileno = sys.stderr.fileno()
          # The Twisted Logger will return an invalid file descriptor since it is not backed
          # by an FD. So, let's also forward this to the same code path as with pytest-xdist.
          if fileno == -1:
              raise AttributeError()
          return fileno
      except (AttributeError, ValueError):
          # pytest-xdist monkeypatches sys.stderr with an object that is not an actual file.
          # https://docs.python.org/3/library/faulthandler.html#issue-with-file-descriptors
          # This is potentially dangerous, but the best we can do.
          return sys.__stderr__.fileno()
  
file_path: catboost/contrib/python/pytest/py3/_pytest/faulthandler.py
imports: import os
  import sys
  from typing import Generator
  import pytest
  from _pytest.config import Config
  from _pytest.config.argparsing import Parser
  from _pytest.nodes import Item
  from _pytest.stash import StashKey
label_desc: Use image node_id 4 for calling a global function with example usage: get_stderr_fileno() and returns: fileno, sys