def labels_to_onehot(labels, classes):

    """ Convert a list of labels (integers) into one-hot format.

    Parameters
    ----------
    labels : list
        A list of integer labels, counting from 0.
    classes : int
        Number of class integers.

    Returns
    -------
    list
        List of one-hot lists.

    """

    for c, i in enumerate(labels):
        onehot    = [0] * classes
        onehot[i] = 1
        labels[c] = onehot

    return labels