def _is_valid_libsvm_label(libsvm_label):
    """Check if LIBSVM label is formatted like so:

    <label> if just label
    <label>:<instance_weight> if label and instance weight both exist

    :param libsvm_label:
    """
    split_label = libsvm_label.split(":")

    if len(split_label) <= 2:
        for label_part in split_label:
            try:
                float(label_part)
            except:
                return False
    else:
        return False

    return True