More on this topic can be found at https://doughellmann.com/blog/2012/04/30/determining-the-name-of-a-process-from-python/.