def cleanup_labels(np_data, labels):
    """
    Make sure there's the right number of labels. Including making new ones
    from scratch if there aren't any
    """

    if labels is not None:
        if len(labels) != np_data.shape[1]:
            err_text = (
                'Number of labels, {}, does not match '
                'number of data features, {}'
                ).format(len(labels), np_data.shape[1])

            raise ValueError(err_text)
    else:
        labels = list(range(np_data.shape[1]))

    return labels