code: def _calc_mem_info(self, unit, meminfo, memory):
          
          if memory:
              total_mem_kib = meminfo["MemTotal:"]
              used_mem_kib = (
                  total_mem_kib
                  - meminfo["MemFree:"]
                  - (
                      meminfo["Buffers:"]
                      + meminfo["Cached:"]
                      + (meminfo["SReclaimable:"] - meminfo["Shmem:"])
                  )
              )
          else:
              total_mem_kib = meminfo["SwapTotal:"]
              used_mem_kib = total_mem_kib - meminfo["SwapFree:"]
  
          used_percent = 100 * used_mem_kib / total_mem_kib
  
          unit = "B" if unit == "dynamic" else unit
          (total, total_unit) = self.py3.format_units(total_mem_kib * 1024, unit)
          (used, used_unit) = self.py3.format_units(used_mem_kib * 1024, unit)
          return total, total_unit, used, used_unit, used_percent
docs: Parse /proc/meminfo, grab the memory capacity and used size
          then return; Memory size 'total_mem', Used_mem, percentage
          of used memory, and units of mem (KiB, MiB, GiB).