code: def _resolve_msg_to_reason(
      func_name: str, reason: str, msg: Optional[str] = None
  ) -> str:
      """
      Handles converting the deprecated msg parameter if provided into
      reason, raising a deprecation warning.  This function will be removed
      when the optional msg argument is removed from here in future.
  
      :param str func_name:
          The name of the offending function, this is formatted into the deprecation message.
  
      :param str reason:
          The reason= passed into either pytest.fail() or pytest.skip()
  
      :param str msg:
          The msg= passed into either pytest.fail() or pytest.skip().  This will
          be converted into reason if it is provided to allow pytest.skip(msg=) or
          pytest.fail(msg=) to continue working in the interim period.
  
      :returns:
          The value to use as reason.
  
      """
      __tracebackhide__ = True
      if msg is not None:
          if reason:
              from pytest import UsageError
  
              raise UsageError(
                  f"Passing both ``reason`` and ``msg`` to pytest.{func_name}(...) is not permitted."
              )
          warnings.warn(
              KEYWORD_MSG_ARG.format(func=func_name), stacklevel=3
          )
          reason = msg
      return reason
  
imports: import sys
  import warnings
  from typing import Any
  from typing import Callable
  from typing import cast
  from typing import NoReturn
  from typing import Optional
  from typing import Type
  from typing import TypeVar
  from _pytest.deprecated import KEYWORD_MSG_ARG
label_desc: Use image node_id 5 for calling a global function with example usage: _resolve_msg_to_reason(func_name, reason, msg) and returns: reason