code: def physicalMemory():
      
      try:
          return os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')
      except ValueError:
          return int(subprocess.check_output(['sysctl', '-n', 'hw.memsize']).decode('utf-8').strip())
docs: >>> n = physicalMemory()
      >>> n > 0
      True
      >>> n == physicalMemory()
      True