Call out to system_profiler.  Return a dictionary
    of the stuff we are interested in.

def _call_system_profiler(datatype):
    '''
    Call out to system_profiler.  Return a dictionary
    of the stuff we are interested in.
    '''

    p = subprocess.Popen(
        [PROFILER_BINARY, '-detailLevel', 'full',
         '-xml', datatype], stdout=subprocess.PIPE)
    (sysprofresults, sysprof_stderr) = p.communicate(input=None)

    if six.PY2:
        plist = plistlib.readPlistFromString(sysprofresults)
    else:
        plist = plistlib.readPlistFromBytes(sysprofresults)

    try:
        apps = plist[0]['_items']
    except (IndexError, KeyError):
        apps = []

    return apps