def grouped_list_to_list(grouped):
    """
    Takes a list of form [['group', 'item'], ...]
    Returns ['# group', 'item', ...]
    """
    result = []
    group = ''
    for pair in grouped:
        if not pair[0] == group:
            group = pair[0]
            result.append('# ' + group)
        result.append(pair[1])
    return result