def transform_pools(values):
    """Transform the output of pools to something more manageable.

    :param list values: The list of values from `SHOW POOLS`
    :rtype: dict

    """
    output = {}
    for row in values:
        if row['database'] not in output:
            output[row['database']] = {}
        if row['user'] not in output[row['database']]:
            output[row['database']][row['user']] = {}
        for k, v in row.items():
            if k in ['database', 'user']:
                continue
            output[row['database']][row['user']][k] = v
    return output