def applications():
 apps = _call_system_profiler('SPApplicationsDataType')
 appdict = {}
 for a in apps:
  details = dict(a)
  details.pop('_name')
  if ('lastModified' in details):
   details['lastModified'] = details['lastModified'].strftime('%Y-%m-%d %H:%M:%S')
  if ('info' in details):
   try:
    details['info'] = '{0}: {1}'.format(details['info'][0], details['info'][1].strftime('%Y-%m-%d %H:%M:%S'))
   except (IndexError, AttributeError):
    pass
  if (a['_name'] not in appdict):
   appdict[a['_name']] = []
  appdict[a['_name']].append(details)
 return appdict

def applications ( ) : apps = _call_system_profiler ( 'SPApplicationsDataType' ) appdict = { } for a in apps : details = dict ( a ) details . pop ( '_name' ) if ( 'lastModified' in details ) : details [ 'lastModified' ] = details [ 'lastModified' ] . strftime ( '%Y-%m-%d %H:%M:%S' ) if ( 'info' in details ) : try : details [ 'info' ] = '{0}: {1}' . format ( details [ 'info' ] [ 0 ] , details [ 'info' ] [ 1 ] . strftime ( '%Y-%m-%d %H:%M:%S' ) ) except ( IndexError , AttributeError ) : pass if ( a [ '_name' ] not in appdict ) : appdict [ a [ '_name' ] ] = [ ] appdict [ a [ '_name' ] ] . append ( details ) return appdict
return the results of a call to system_profiler -xml -detail full spapplicationsdatatype as a dictionary .