def compare(item1, item2):
    """
    compares first identity and if equals the score
    :param item1:
    :param item2:
    :return:
    """
    data1, data2 = item1[1], item2[1]
    if data1 is None and data2 is None:
        return 0
    elif data1 is None and data2 is not None:
        return -1
    elif data1 is not None and data2 is None:
        return +1
    else:
        res = data1.data['best']['identity'] - data2.data['best']['identity']
        if res == 0:
            res = data1.data['best']['score'] - data2.data['best']['score']
        return res
