def _merge_str(l):
    """Concatenate consecutive strings in a list of nodes."""
    out = []
    for node in l:
        if (out and isinstance(out[-1], str) and
                isinstance(node, str)):
            out[-1] += node
        else:
            out.append(node)
    return out