psutil should work well for this.
"psutil is a module that provides an interface for obtaining information about all running processes and using the system (CPU, memory) in a portable way using Python, which implements many functions offered by command-line tools such as ps, top, kill, lsof and netstat. "
source share