import operator


def get_best_nzb(nzb_downloads):
    """Sort the NZB to return the first complete or best incomplete NZB

    :param nzb_downloads: NZB downloads
    :returns: list with values from best NZB
    """
    # Only one NZB file
    if len(nzb_downloads) == 1:
        return nzb_downloads[0]

    sorted_nzb = sorted(nzb_downloads, key=operator.itemgetter(2, 3))
    return sorted_nzb[0]