def fdr(plist, alpha):
    """ Return the false discovery rate for the repeated-test
    p-values in plist, at significance level alpha. """
    m = len(plist)
    plist = sorted(plist)
    for k in range(0, m):
        if (k+1) / float(m) * alpha >= plist[k]:
            return k