def ret2dict(estimationresult):
    """
    Convert the estimationresult to a single dictionary of key/value pairs.

    The estimationresult is a list of dicts, where each dict corresponds to a head and has a `task_name`
    key. The return value is a merged dict which has all keys prefixed with the task name and the task name
    keys removed, as well as the keys "report" and "confusion" and all other entries where the value is a list or dict.
    """
    new = {}
    for d in estimationresult:
        name = d["task_name"]
        for k, v in d.items():
            if k != "task_name" and k != "report" and not k.startswith("confusion") and not isinstance(v, (list, dict)):
                new[name+"_"+k] = v
    return new