code: def safe_getattr(object: Any, name: str, default: Any) -> Any:
      """Like getattr but return default upon any Exception or any OutcomeException.
  
      Attribute access can potentially fail for 'evil' Python objects.
      See issue #214.
      It catches OutcomeException because of #2490 (issue #580), new outcomes
      are derived from BaseException instead of Exception (for more details
      check #2707).
      """
      from _pytest.outcomes import TEST_OUTCOME
  
      try:
          return getattr(object, name, default)
      except TEST_OUTCOME:
          return default
  
imports: from __future__ import annotations
  import dataclasses
  import enum
  import functools
  import inspect
  import os
  import sys
  from inspect import Parameter
  from inspect import signature
  from pathlib import Path
  from typing import Any
  from typing import Callable
  from typing import Generic
  from typing import NoReturn
  from typing import TYPE_CHECKING
  from typing import TypeVar
  import _pytest._py.path
label_desc: Use image node_id 16 for calling a global function with example usage: safe_getattr(object, name, default) and returns: getattr, default