code: def call_optional(obj: object, name: str, nodeid: str) -> bool:
      method = getattr(obj, name, None)
      if method is None:
          return False
      is_fixture = getfixturemarker(method) is not None
      if is_fixture:
          return False
      if not callable(method):
          return False
      # Warn about deprecation of this plugin.
      method_name = getattr(method, "__name__", str(method))
      warnings.warn(
          NOSE_SUPPORT.format(
              nodeid=nodeid, method=method_name, stage=name
          ),
          stacklevel=2,
      )
      # If there are any problems allow the exception to raise rather than
      # silently ignoring it.
      method()
      return True
  
file_path: catboost/contrib/python/pytest/py3/_pytest/nose.py
imports: import warnings
  from _pytest.config import hookimpl
  from _pytest.deprecated import NOSE_SUPPORT
  from _pytest.fixtures import getfixturemarker
  from _pytest.nodes import Item
  from _pytest.python import Function
  from _pytest.unittest import TestCaseFunction
label_desc: Use image node_id 2 for calling a global function with example usage: call_optional(obj, name, nodeid) and returns: True, False, False, False