def _call_system_profiler(datatype):
 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

def _call_system_profiler ( datatype ) : 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
call out to system_profiler .