def pick_best_loci(patterns):
    """
    For patterns with multiple loci, pick the loci with the most
    conserved primer zones
    
    Input: 
        patterns: A dictionary of patterns
    Output: A dictionary with a single loci from each pattern
    """
    
    return {pattern: sorted(loci,
        key=lambda k: (loci[k]['primer_zone']['percent_ok'],
        loci[k]['primer_zone']['med_size']),
        reverse=True)[0] for pattern, loci in patterns.items()}