def get_most_common_factors(seq_factors):
    factor_counts = {}
    for seq in seq_factors:
        factor_list = seq_factors[seq]
        for factor in factor_list:
            if (factor not in factor_counts):
                factor_counts[factor] = 0
            factor_counts[factor] += 1
    factors_by_count = []
    for factor in factor_counts:
        if (factor <= MAX_KEY_LENGTH):
            factors_by_count.append((factor, factor_counts[factor]))
    factors_by_count.sort(key=get_item_at_index_one, reverse=True)
    return factors_by_count
def get_most_common_factors(seq_factors):
    factor_counts = {}
    for seq in seq_factors:
        factor_list = seq_factors[seq]
        for factor in factor_list:
            if (factor not in factor_counts):
                factor_counts[factor] = 0
            factor_counts[factor] += 1
    factors_by_count = []
    for factor in factor_counts:
        if (factor <= MAX_KEY_LENGTH):
            factors_by_count.append((factor, factor_counts[factor]))
    factors_by_count.sort(key=get_item_at_index_one, reverse=True)
    return factors_by_count