code: def _handle_command_with_client(
      command: str,
      metadata: Dict,
      app_name: str,
      app_id: Optional[str],
      url: str,
  ):
      debug_mode = bool(int(os.getenv("DEBUG", "0")))
  
      if app_name == "localhost":
          target_file = metadata["cls_path"]
      else:
          target_file = (
              _resolve_command_path(command)
              if debug_mode
              else _resolve_command_path(command)
          )
  
      if debug_mode:
          print(target_file)
  
      client_command = _download_command(
          command,
          metadata["cls_path"],
          metadata["cls_name"],
          app_id,
          debug_mode=debug_mode,
          target_file=target_file
          if debug_mode
          else _resolve_command_path(command),
      )
      client_command._setup(command_name=command, app_url=url)
      sys.argv = sys.argv[len(command.split("_")) :]
      client_command.run()
  
file_path: pytorch-lightning/src/lightning/app/cli/commands/app_commands.py
imports: import os
  import sys
  from typing import Dict, Optional
  import requests
  from lightning.app.cli.connect.app import _clean_lightning_connection, _install_missing_requirements, _resolve_command_path
  from lightning.app.utilities.cli_helpers import _LightningAppOpenAPIRetriever
  from lightning.app.utilities.commands.base import _download_command
  from lightning.app.utilities.enum import OpenAPITags
label_desc: Use image node_id 4 for calling a global function with example usage: _handle_command_with_client(command, metadata, app_name, app_id, url) without return types