code: def post_run_cell(self, result):
      if not self.running:
          return
  
      # this sends a signal to peak_monitor_func to complete its loop
      self.peak_monitoring = False
  
      self.time_delta = time.time() - self.time_start
  
      if self.gc_collect:
          gc.collect()
  
      # tracemalloc was tried, but it misses all non-python memory allocations so it had to go
  
      self.cpu_mem_used_new = cpu_ram_used()
      self.cpu_mem_used_delta = (
          self.cpu_mem_used_new - self.cpu_mem_used_at_cell_start
      )
      # see the logic for gpu below for details of the following
      self.cpu_mem_peaked_delta = max(
          0, self.cpu_mem_used_peak - self.cpu_mem_used_at_cell_start
      )
      if self.cpu_mem_used_delta > 0:
          self.cpu_mem_peaked_delta = max(
              0, self.cpu_mem_peaked_delta - self.cpu_mem_used_delta
          )
  
      if self.backend == "pytorch":
          self.gpu_mem_used_new = self.gpu_ram_used()
  
          # delta_used is the difference between used mem at current vs. at cell start
          self.gpu_mem_used_delta = (
              self.gpu_mem_used_new - self.gpu_mem_used_at_cell_start
          )
  
          # peaked_delta is the temporary overhead if any.
          #
          # the idea is that in order to know how much memory the cell consumed one needs to sum
          # up used delta and peaked delta
          #
          # It is calculated as follows:
          #
          # 1. The difference between the peak memory and the used memory at the
          # start is measured:
          # 2a. If it's negative, then peaked_delta is 0
          # 2b. Otherwise, if used_delta is positive it gets subtracted from peaked_delta
          # XXX: 2a shouldn't be needed once we have a reliable peak counter
          self.gpu_mem_peaked_delta = max(
              0,
              self.gpu_mem_used_peak - self.gpu_mem_used_at_cell_start,
          )
          if self.gpu_mem_used_delta > 0:
              self.gpu_mem_peaked_delta = max(
                  0, self.gpu_mem_peaked_delta - self.gpu_mem_used_delta
              )
  
      if self.compact:
          if 1:
              out = f"CPU: {b2mb(self.cpu_mem_used_delta):0.0f}/{b2mb(self.cpu_mem_peaked_delta):0.0f}/{b2mb(self.cpu_mem_used_new):0.0f} MB"
          if self.backend == "pytorch":
              out += f" | GPU: {b2mb(self.gpu_mem_used_delta):0.0f}/{b2mb(self.gpu_mem_peaked_delta):0.0f}/{b2mb(self.gpu_mem_used_new):0.0f} MB"
          out += f" | Time {secs2time(self.time_delta)} | (Consumed/Peaked/Used Total)"
          print(out)
      else:
          if 1:
              vals = [
                  self.cpu_mem_used_delta,
                  self.cpu_mem_peaked_delta,
                  self.cpu_mem_used_new,
              ]
          if self.backend == "pytorch":
              vals += [
                  self.gpu_mem_used_delta,
                  self.gpu_mem_peaked_delta,
                  self.gpu_mem_used_new,
              ]
          w = int2width(*map(b2mb, vals)) + 1  # some air
          if w < 10:
              w = 10  # accommodate header width
          pre = "･ "
          print(
              f"{pre}RAM: {'△Consumed':>{w}} {'△Peaked':>{w}}    {'Used Total':>{w}} | Exec time {secs2time(self.time_delta)}"
          )
          if 1:
              print(
                  f"{pre}CPU: {b2mb(self.cpu_mem_used_delta):{w},.0f} {b2mb(self.cpu_mem_peaked_delta):{w},.0f} {b2mb(self.cpu_mem_used_new):{w},.0f} MB |"
              )
          if self.backend == "pytorch":
              print(
                  f"{pre}GPU: {b2mb(self.gpu_mem_used_delta):{w},.0f} {b2mb(self.gpu_mem_peaked_delta):{w},.0f} {b2mb(self.gpu_mem_used_new):{w},.0f} MB |"
              )
  
      # for self.data accessor
      self.cpu_mem_used_prev = self.cpu_mem_used_new
      if self.backend == "pytorch":
          self.gpu_mem_used_prev = self.gpu_mem_used_new
  
      self.data = CellLoggerData(
          CellLoggerMemory(
              self.cpu_mem_used_delta,
              self.cpu_mem_peaked_delta,
              self.cpu_mem_used_prev,
          ),
          CellLoggerMemory(
              self.gpu_mem_used_delta,
              self.gpu_mem_peaked_delta,
              self.gpu_mem_used_prev,
          ),
          CellLoggerTime(self.time_delta),
      )
  
imports: from IPython import get_ipython
  from collections import namedtuple
  import datetime
  import gc
  import logging
  import os
  import psutil
  import random
  import sys
  import threading
  import time
label_desc: Use image node_id 10 for calling the CellLogger obj's underlying member method code with example usage: obj.post_run_cell(result) without return types