'Clean up after the parser by discarding empty Unicode strings and merging
substring sequences.  Empty or single-value join lists are not uncommon
because f-string format specs are always parsed into JoinedStrNodes.'

def visit_JoinedStrNode(self, node):

    self.visitchildren(node)
    unicode_node = ExprNodes.UnicodeNode
    values = []
    for (is_unode_group, substrings) in itertools.groupby(node.values, (lambda v: isinstance(v, unicode_node))):
        if is_unode_group:
            substrings = list(substrings)
            unode = substrings[0]
            if (len(substrings) > 1):
                unode.value = EncodedString(u''.join((value.value for value in substrings)))
            if unode.value:
                values.append(unode)
        else:
            values.extend(substrings)
    if (not values):
        node = ExprNodes.UnicodeNode(node.pos, value=EncodedString(''))
    elif (len(values) == 1):
        node = values[0]
    elif (len(values) == 2):
        node = ExprNodes.binop_node(node.pos, '+', *values)
    else:
        node.values = values
    return node
