I too used the very useful Python script provided above.
I found the culprit was none of the faceless helper apps I expected.
Apparently, in my case, Parallels 13 is the culprit.
I just upgraded and renewed my subscription to it and the new Parallels Access in it is stealing focus.
Even worse, it is doing it most irritatingly when I am trying to type in a new filename for a PDF open in Preview. (That Preview app in Sierra itself has a recent new flaw that prevents filename changes typed into the document window title bar from being saved unless you hit Tab or something before hitting Enter).
I just quit Access and will file a report with Parallels because I do rely in Access to use my various Macs from each other or iOS devices.
Imran
2017-08-28 05:36:51: Parallels Access Agent [/Applications/Parallels Access.app/Contents/MacOS/Parallels Access Agent.app]
2017-08-28 05:37:17: Parallels Access [/Applications/Parallels Access.app]