def split_instance_line(line):
    """Splits an instance line, supplied in the similar format as
    that used by SVMLight package, to labels, qid, attributes and comment.
    Labels are the first sequence of characters at the start of line,
    then follows optionally a qid-attribute, then normal attributes,
    and finally # can be used to comment out rest of the line."""
    line = line.strip().split()
    identity = line.pop(0)
    #One or more labels, using separator |, are supposed to be at
    #the beginning of the line
    labels = line.pop(0)
    return labels, line, identity