def _collapse_entries(entries):
    """
    Convert [['key', 'value1'], ['key', 'value2]] to [['key', ['value1', 'value2']]]
    Expect key values to be consecutive. Will maintain order as provided.
    """
    if entries is None or len(entries) < 1:
        return []
    else:
        cur_key = entries[0][0]
        cur_value = []
        new_entry = []
    for entry in entries:
        if entry[0] == cur_key:
            cur_value.append(entry[1])
        else:
            cur_key = entry[0]
            cur_value = [entry[1]]
            new_entry.append([cur_key, cur_value])
    new_entry.append([cur_key, cur_value])
    return new_entry
