code: def private_function_across_module(
      file_obj: IO[str],
  ) -> Iterable[tuple[int, str]]:
      """
      Checking that a private function is not used across modules.
      Parameters
      ----------
      file_obj : IO
          File-like object containing the Python code to validate.
      Yields
      ------
      line_number : int
          Line number of the private function that is used across modules.
      msg : str
          Explanation of the error.
      """
      contents = file_obj.read()
      tree = ast.parse(contents)
  
      imported_modules: set[str] = set()
  
      for node in ast.walk(tree):
          if isinstance(node, (ast.Import, ast.ImportFrom)):
              for module in node.names:
                  module_fqdn = (
                      module.name
                      if module.asname is None
                      else module.asname
                  )
                  imported_modules.add(module_fqdn)
  
          if not isinstance(node, ast.Call):
              continue
  
          try:
              module_name = node.func.value.id
              function_name = node.func.attr
          except AttributeError:
              continue
  
          # Exception section #
  
          # (Debatable) Class case
          if module_name[0].isupper():
              continue
          # (Debatable) Dunder methods case
          elif function_name.startswith(
              "__"
          ) and function_name.endswith("__"):
              continue
          elif (
              module_name + "." + function_name
              in PRIVATE_FUNCTIONS_ALLOWED
          ):
              continue
  
          if (
              module_name in imported_modules
              and function_name.startswith("_")
          ):
              yield (
                  node.lineno,
                  f"Private function '{module_name}.{function_name}'",
              )
  
file_path: pandas/scripts/validate_unwanted_patterns.py
imports: import argparse
  import ast
  from collections.abc import Iterable
  import sys
  import token
  import tokenize
  from typing import IO, Callable
label_desc: Use image node_id 2 for calling a global function with example usage: private_function_across_module(file_obj) without return types