If it helps any, this is a short script I wrote to use in Checkbox to determine if we're running Unity or not. I did this after talking to Alex Launi about the proper way to determine which environment we're currently running since Unity bits are installed regardless of whether or not the system can actually run Unity.

I should add that the script also calls autopilot.py and returns exit status based on whether autopilot was successful or not. But it should give you what you need to accurately check for Unity via dbus.