code: def _get_process_used_memory(self):
      def mem_usage_children(a_mem_size, pr, parent_mem=None):
          self._last_process_id_list.append(pr.pid)
          # add out memory usage
          our_mem = pr.memory_info()
          mem_diff = (
              our_mem.rss - parent_mem.rss
              if parent_mem
              else our_mem.rss
          )
          a_mem_size += mem_diff if mem_diff > 0 else 0
          # now we are the parent
          for child in pr.children():
              # get the current memory
              m = pr.memory_info()
              mem_diff = m.rss - our_mem.rss
              a_mem_size += mem_diff if mem_diff > 0 else 0
              a_mem_size = mem_usage_children(
                  a_mem_size, child, parent_mem=m
              )
          return a_mem_size
  
      # only run the memory usage query once per reporting period
      # because this memory query is relatively slow, and changes very little.
      if (
          self._last_process_pool.get("cpu")
          and (time() - self._last_process_pool["cpu"][0])
          < self._report_frequency
      ):
          return self._last_process_pool["cpu"][1]
  
      # if we have no parent process, return 0 (it's an error)
      if not self._process_info:
          return 0
  
      self._last_process_id_list = []
      mem_size = mem_usage_children(0, self._process_info)
      self._last_process_pool["cpu"] = time(), mem_size
  
      return mem_size
  
imports: import logging
  import os
  import platform
  import sys
  import warnings
  from time import time
  import psutil
  from pathlib2 import Path
  from typing import Text
  from .process.mp import BackgroundMonitor
  from ..backend_api import Session
  from ..binding.frameworks.tensorflow_bind import IsTensorboardInit
label_desc: Use image node_id 10 for calling the ResourceMonitor obj's underlying member method code with example usage: obj._get_process_used_memory() and returns: mem_size, a_mem_size, self, int