code: def _wrapping_function(args_pack: tuple) -> Any:  # type: ignore[override]
      (
          global_rank,
          trainer,
          strategy,
          function,
          args,
          kwargs,
          patch_status,
      ) = args_pack
      invalidInputError(
          isinstance(strategy, RayStrategy), "expect ray strategy here"
      )
      invalidInputError(
          isinstance(strategy.cluster_environment, RayEnvironment),
          "expect ray environment here",
      )
  
      # patch Pytorch and CUDA in subprocess
      if patch_status["patch_torch"]:
          from bigdl.nano.pytorch import patch_torch
  
          patch_torch(cuda_to_cpu=patch_status["patch_cuda"])
  
      strategy.cluster_environment.set_global_rank(global_rank)
      strategy.cluster_environment.set_remote_execution(True)
  
      strategy._worker_setup(global_rank)
      results = function(*args, **kwargs)
  
      # when using pytorch lightning's trainer, the `trainer` cannot be None,
      # when using pytorch lightning's LightningLite, the `trainer` should be None
      if trainer is not None:
          results = strategy._launcher._collect_rank_zero_results(
              trainer, results
          )
  
      if strategy.global_rank == 0:
          return move_data_to_device(results, "cpu")
  
imports: import os
  import warnings
  from typing import Callable, Dict, List, Union, Any, Optional
  from collections import defaultdict
  import ray
  from ray.util.ml_utils.util import find_free_port
  import torch
  from torch.optim.lr_scheduler import _LRScheduler
  from torch.nn.parallel.distributed import DistributedDataParallel
  import pytorch_lightning
  from pytorch_lightning.core.datamodule import LightningDataModule
  from pytorch_lightning.trainer.states import TrainerFn
  from pytorch_lightning.utilities import rank_zero_only
  from pytorch_lightning.utilities.apply_func import move_data_to_device
  from pytorch_lightning.strategies.launchers import _SpawnLauncher
  from pytorch_lightning.strategies import DDPSpawnStrategy
  from pytorch_lightning.core.optimizer import _configure_schedulers_automatic_opt
  from pytorch_lightning.core.optimizer import _configure_schedulers_manual_opt
  from pytorch_lightning.core.optimizer import _set_scheduler_opt_idx, _validate_scheduler_api
  from pytorch_lightning.core.optimizer import LightningOptimizer
  from .ray_envbase import RayEnvironment
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.utils.pytorch import TORCH_VERSION_LESS_1_12
  from bigdl.nano.deps.ipex.ipex_api import ipex_optimize
  from bigdl.nano.pytorch.dispatcher import _get_patch_status
label_desc: Use image node_id 4 for calling the _RayLauncher obj's underlying member method code with example usage: obj._wrapping_function(args_pack) and returns: move_data_to_device