def get_table_head(runSetResults, commonFileNamePrefix):

    # This list contains the number of columns each run set has
    # (the width of a run set in the final table)
    # It is used for calculating the column spans of the header cells.
    runSetWidths = [len(runSetResult.columns) for runSetResult in runSetResults]

    for runSetResult in runSetResults:
        # Ugly because this overwrites the entries in the map,
        # but we don't need them anymore and this is the easiest way
        for key in runSetResult.attributes:
            values = runSetResult.attributes[key]
            if key == 'turbo':
                turbo_values = list(set(values))
                if len(turbo_values) > 1:
                    turbo = 'mixed'
                elif turbo_values[0] == 'true':
                    turbo = 'enabled'
                elif turbo_values[0] == 'false':
                    turbo = 'disabled'
                else:
                    turbo = None
                runSetResult.attributes['turbo'] = ', Turbo Boost: {}'.format(turbo) if turbo else ''

            elif key == 'timelimit':
                def fix_unit_display(value):
                    if len(value) >= 2 and value[-1] == 's' and value[-2] != ' ':
                        return value[:-1] + ' s'
                    return value
                runSetResult.attributes[key] = Util.prettylist(map(fix_unit_display, values))

            elif key == 'memlimit' or key == 'ram':
                def round_to_MB(value):
                    try:
                        return "{:.0f} MB".format(int(value)/_BYTE_FACTOR/_BYTE_FACTOR)
                    except __HOLE__:
                        return value
                runSetResult.attributes[key] = Util.prettylist(map(round_to_MB, values))

            elif key == 'freq':
                def round_to_MHz(value):
                    try:
                        return "{:.0f} MHz".format(int(value)/1000/1000)
                    except ValueError:
                        return value
                runSetResult.attributes[key] = Util.prettylist(map(round_to_MHz, values))

            else:
                runSetResult.attributes[key] = Util.prettylist(values)

    def get_row(rowName, format_string, collapse=False, onlyIf=None, default='Unknown'):
        def format_cell(attributes):
            if onlyIf and not onlyIf in attributes:
                formatStr = default
            else:
                formatStr = format_string
            return formatStr.format(**attributes)

        values = [format_cell(runSetResult.attributes) for runSetResult in runSetResults]
        if not any(values):
            return None # skip row without values completely

        valuesAndWidths = list(Util.collapse_equal_values(values, runSetWidths)) \
                          if collapse else list(zip(values, runSetWidths))

        return tempita.bunch(id=rowName.lower().split(' ')[0],
                             name=rowName,
                             content=valuesAndWidths)

    titles      = [column.format_title() for runSetResult in runSetResults for column in runSetResult.columns]
    runSetWidths1 = [1]*sum(runSetWidths)
    titleRow    = tempita.bunch(id='columnTitles', name=commonFileNamePrefix,
                                content=list(zip(titles, runSetWidths1)))

    return {'tool':    get_row('Tool', '{tool} {version}', collapse=True),
            'limit':   get_row('Limits', 'timelimit: {timelimit}, memlimit: {memlimit}, CPU core limit: {cpuCores}', collapse=True),
            'host':    get_row('Host', '{host}', collapse=True, onlyIf='host'),
            'os':      get_row('OS', '{os}', collapse=True, onlyIf='os'),
            'system':  get_row('System', 'CPU: {cpu}, cores: {cores}, frequency: {freq}{turbo}; RAM: {ram}', collapse=True, onlyIf='cpu'),
            'date':    get_row('Date of execution', '{date}', collapse=True),
            'runset':  get_row('Run set', '{niceName}'),
            'branch':  get_row('Branch', '{branch}'),
            'options': get_row('Options', '{options}'),
            'property':get_row('Propertyfile', '{propertyfiles}', collapse=True, onlyIf='propertyfiles', default=''),
            'title':   titleRow}
dataset/ETHPy150Open sosy-lab/benchexec/benchexec/tablegenerator/__init__.py/get_table_head