code: def stop_background_task(method):
      logger.info(f"Kill background task for {method}")
      if not background_tasks.get(
          method
      ) or not background_processes.get(method):
          return None
  
      task_id, process = next(
          iter(background_processes[method].items())
      )
      children = psutil.Process(pid=process.pid).children(
          recursive=True
      )
      for child in children:
          logger.info(f"Kill:: Child pid is {child.pid}")
          child.kill()
      logger.info(f"Kill:: Process pid is {process.pid}")
      process.kill()
  
      background_processes[method].pop(task_id, None)
      logger.info(f"Killed background process: {process.pid}")
  
      task = [
          task
          for task in background_tasks[method]
          if task["id"] == task_id
      ][0]
      task["status"] = "STOPPED"
      task["end_ts"] = datetime.today().strftime("%Y-%m-%d %H:%M:%S")
      return task
  
file_path: MONAILabel/monailabel/utils/async_tasks/utils.py
imports: import json
  import logging
  import os
  import os.path
  import random
  import subprocess
  import sys
  import uuid
  from collections import deque
  from concurrent.futures import ThreadPoolExecutor
  from datetime import datetime
  from typing import Dict
  import psutil
label_desc: Use image node_id 3 for calling a global function with example usage: stop_background_task(method) and returns: task, None