code: def get_child_process_ids(pid):
      """Retrieve all child pids for a certain pid
  
      Recursively scan each childs process tree and add it to the output
  
      Args:
          pid (int): process id
  
      Returns:
          (List[int]): Child process ids
      """
      cmd = f"pgrep -P {pid}".split()
      process = subprocess.Popen(
          cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
      )
      output, err = process.communicate()
      if err:
          return []
      pids = [int(pid) for pid in output.decode("utf-8").split()]
      if pids:
          for child_pid in pids:
              return pids + get_child_process_ids(child_pid)
      else:
          return []
  
file_path: sagemaker-python-sdk/src/sagemaker/local/utils.py
imports: from __future__ import absolute_import
  import os
  import logging
  import shutil
  import subprocess
  import json
  import re
  import errno
  from distutils.dir_util import copy_tree
  from six.moves.urllib.parse import urlparse
  from sagemaker import s3
label_desc: Use image node_id 5 for calling a global function with example usage: get_child_process_ids(pid) and returns: list, list, unknown