code: def _getBundleId(self):
          
          ra = AppKit.NSRunningApplication
          app = ra.runningApplicationWithProcessIdentifier_(
              self._getPid())
          return app.bundleIdentifier()
docs: Return the bundle ID of the application.