code: def _call_strategy_hook(
      trainer: "pl.Trainer",
      hook_name: str,
      *args: Any,
      **kwargs: Any,
  ) -> Any:
      log.debug(
          f"{trainer.__class__.__name__}: calling strategy hook: {hook_name}"
      )
  
      pl_module = trainer.lightning_module
      prev_fx_name = pl_module._current_fx_name
      pl_module._current_fx_name = hook_name
  
      fn = getattr(trainer.strategy, hook_name)
      if not callable(fn):
          return None
  
      with trainer.profiler.profile(
          f"[Strategy]{trainer.strategy.__class__.__name__}.{hook_name}"
      ):
          output = fn(*args, **kwargs)
  
      # restore current_fx when nested context
      pl_module._current_fx_name = prev_fx_name
  
      return output
  
imports: import logging
  from copy import deepcopy
  from typing import Any, Callable, Dict, Optional, Type, Union
  from packaging.version import Version
  import lightning.pytorch
  from lightning.fabric.utilities.device_dtype_mixin import _DeviceDtypeModuleMixin
  from lightning.pytorch.callbacks import Checkpoint, EarlyStopping
  from lightning.pytorch.trainer.states import TrainerStatus
  from lightning.pytorch.utilities.exceptions import _TunerExitException
  from lightning.pytorch.utilities.model_helpers import is_overridden
  from lightning.pytorch.utilities.rank_zero import rank_zero_warn
label_desc: Use image node_id 12 for calling a global function with example usage: _call_strategy_hook(trainer, hook_name) and returns: output, None