def get_biggest_api(darshan_data):
    """
    Determine the most-used API and file system based on the Darshan log
    """
    if 'counters' not in darshan_data:
        return {}
    biggest_api = {}
    for api_name in darshan_data['counters']:
        biggest_api[api_name] = {'write': 0, 'read': 0, 'write_files': 0,
            'read_files': 0}
        for file_path, records in darshan_data['counters'][api_name].items():
            if file_path.startswith('_'):
                continue
            for record in records.values():
                bytes_read = record.get('BYTES_READ')
                if bytes_read:
                    biggest_api[api_name]['read'] += bytes_read
                    biggest_api[api_name]['read_files'] += 1
                bytes_written = record.get('BYTES_WRITTEN')
                if bytes_written:
                    biggest_api[api_name]['write'] += bytes_written
                    biggest_api[api_name]['write_files'] += 1
    results = {}
    for readwrite in ('read', 'write'):
        key = 'biggest_%s_api' % readwrite
        results[key] = max(biggest_api, key=lambda k, rw=readwrite:
            biggest_api[k][rw])
        results['%s_bytes' % key] = biggest_api[results[key]][readwrite]
        results['%s_files' % key] = biggest_api[results[key]][readwrite +
            '_files']
    return results
