<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def indices2one_hot(indices, nb_classes):
 """ Convert an iterable of indices to one-hot encoded list. You might also be interested in sklearn.preprocessing.OneHotEncoder Parameters indices : iterable iterable of indices nb_classes : int Number of classes dtype : type Returns ------- one_hot : list Examples -------- [[1, 0, 0], [0, 1, 0], [0, 1, 0]] [[1, 0], [0, 1], [0, 1]] """

    if nb_classes < 1:
        raise ValueError('nb_classes={}, but positive number expected'
                         .format(nb_classes))

    one_hot = []
    for index in indices:
        one_hot.append([0] * nb_classes)
        one_hot[-1][index] = 1
    return one_hot