def GetAppInfo(self, user_info):
    """Grabs the application info from the user_info dictionary.

    Args:
      user_info: dictionary of application info

    Returns:
      tuple of bundle_id, app_version, app_path
    """
    bundle_id, app_version, app_path = None, None, None
    try:
      bundle_id = user_info['NSApplicationBundleIdentifier']
    except __HOLE__:
      # Malformed applications may not have NSApplicationBundleIdentifier
      # Return NSApplicationName instead
      logging.error('Error reading bundle identifier: %s', user_info)
      bundle_id = user_info['NSApplicationName']
    try:
      app_path = user_info['NSApplicationPath']
    except KeyError:
      # Malformed applications may not have NSApplicationPath
      logging.error('Error reading application path: %s', user_info)
    if app_path:
      try:
        app_info_plist = NSDictionary.dictionaryWithContentsOfFile_(
            '%s/Contents/Info.plist' % app_path)
        if app_info_plist:
          app_version = app_info_plist['CFBundleVersion']
      except KeyError:
        logging.error('Error reading application version from %s', app_path)

    return bundle_id, app_version, app_path
dataset/ETHPy150Open google/macops/crankd/ApplicationUsage.py/ApplicationUsage.GetAppInfo