def homer_get_mode_tag_length(tag_length_distribution_filename):
    """
    Parses HOMER's tagLengthDistribution.txt file and returns the mode (most common value) of the distribution
    """
    tag_length_frequencies = []
    with open(tag_length_distribution_filename) as tag_length_file:
        tag_length_file.readline()
        tag_length_frequencies = []
        for line in tag_length_file:
            split_line = line.split('\t')
            tag_length_frequencies.append((int(split_line[0]), float(
                split_line[1])))
    return sorted(tag_length_frequencies, key=lambda x: x[1])[-1][0]
