code: def warn_explicit_for(
      method: FunctionType, message: PytestWarning
  ) -> None:
      """
      Issue the warning :param:`message` for the definition of the given :param:`method`
  
      this helps to log warnings for functions defined prior to finding an issue with them
      (like hook wrappers being marked in a legacy mechanism)
      """
      lineno = method.__code__.co_firstlineno
      filename = inspect.getfile(method)
      module = method.__module__
      mod_globals = method.__globals__
      try:
          warnings.warn_explicit(
              message,
              type(message),
              filename=filename,
              module=module,
              registry=mod_globals.setdefault(
                  "__warningregistry__", {}
              ),
              lineno=lineno,
          )
      except Warning as w:
          # If warnings are errors (e.g. -Werror), location information gets lost, so we add it to the message.
          raise type(w)(f"{w}\n at {filename}:{lineno}") from None
  
imports: import dataclasses
  import inspect
  import warnings
  from types import FunctionType
  from typing import Any
  from typing import Generic
  from typing import Type
  from typing import TypeVar
  from _pytest.compat import final
label_desc: Use image node_id 1 for calling a global function with example usage: warn_explicit_for(method, message) without return types