def seqWeightThenLenCmp(seq1, seq2):
    """
        Compares two sequences according to the assignment weight and if it`s the same or not defined,
        it compares them according to their length.
    """
    weight1 = seq1.getTaxonomyPathWeight()
    weight2 = seq2.getTaxonomyPathWeight()
    if (weight1 is not None) and (weight2 is not None):
        if (weight1 - weight2) < 0:
            return -1
        else:
            return 1
    else:
        return seq1.seqBp - seq2.seqBp