title: Getting MacOS process id from user using python
body: <p>I want to get the pid by passing in the user name. For example, in the picture of a macOS activity monitor, the user name is 'root', and I want something that can return all running processes under user name 'root'.</p>
  <p><img src="https://i.stack.imgur.com/BmBDX.png" alt="enter image description here" /></p>