def read_rep(l, index, node):
    """ read l from index and until ] is encountered, return floats read as a rep array"""
    i = index
    rep = []
    word = ""
    while i < len(l):
        c = l[i]
        i += 1
        if (c == ' ' or c == ']'):
            if len(word) > 0:
                f = float(word)  # may throw
                rep.append(f)
                word = ""
            if c == ']':
                break
        else:
            word += c
    node.representation = rep
    return i