'node should have only one item changed'

def _normalize_branch_node(self, node):

    not_blank_items_count = sum((1 for x in range(17) if node[x]))
    assert (not_blank_items_count >= 1)
    if (not_blank_items_count > 1):
        return node
    not_blank_index = [i for (i, item) in enumerate(node) if item][0]
    if (not_blank_index == 16):
        return [pack_nibbles(with_terminator([])), node[16]]
    sub_node = self._decode_to_node(node[not_blank_index])
    sub_node_type = self._get_node_type(sub_node)
    if is_key_value_type(sub_node_type):
        new_key = ([not_blank_index] + unpack_to_nibbles(sub_node[0]))
        return [pack_nibbles(new_key), sub_node[1]]
    if (sub_node_type == NODE_TYPE_BRANCH):
        return [pack_nibbles([not_blank_index]), self._encode_node(sub_node)]
    assert False
