code: def detect_calling_file_or_module_from_task_function(
      task_function: Any,
  ) -> Tuple[Optional[str], Optional[str]]:
      # if function is decorated, unwrap it
      while hasattr(task_function, "__wrapped__"):
          task_function = task_function.__wrapped__
  
      mdl = task_function.__module__
      override = _get_module_name_override()
      if override is not None:
          mdl = override
  
      calling_file: Optional[str]
      calling_module: Optional[str]
      if mdl not in (None, "__main__"):
          calling_file = None
          calling_module = mdl
      else:
          try:
              calling_file = inspect.getfile(task_function)
          except TypeError:
              calling_file = None
          calling_module = None
  
      return calling_file, calling_module
  
imports: import argparse
  import inspect
  import logging.config
  import os
  import sys
  import traceback
  import warnings
  from dataclasses import dataclass
  from os.path import dirname, join, normpath, realpath
  from types import FrameType, TracebackType
  from typing import Any, List, Optional, Sequence, Tuple
  from omegaconf.errors import OmegaConfBaseException
  from hydra._internal.config_search_path_impl import ConfigSearchPathImpl
  from hydra.core.config_search_path import ConfigSearchPath, SearchPathQuery
  from hydra.core.utils import get_valid_filename, validate_config_path
  from hydra.errors import CompactHydraException, InstantiationException, SearchPathException
  from hydra.types import RunMode, TaskFunction
label_desc: Use image node_id 2 for calling a global function with example usage: detect_calling_file_or_module_from_task_function(task_function) and returns: calling_file,  calling_module