code: def mock_subcommand(mock_api_handled_group):
      @mock_api_handled_group.command()
      def cmd():
          pass
  
      return cmd
  
file_path: pytorch-lightning/tests/tests_app/utilities/test_exceptions.py
imports: from json import dumps
  from unittest.mock import MagicMock
  import pytest
  from click import ClickException, group
  from click.testing import CliRunner
  from lightning.app.utilities.exceptions import _ApiExceptionHandler
  from lightning_cloud.openapi.rest import ApiException
  from urllib3 import HTTPResponse
label_desc: Use image node_id 2 for calling a global function with example usage: mock_subcommand(mock_api_handled_group) and returns: cmd