def sort_tag_counts(tag_counts):
    """
    Sort tag counts.

    sort rules: sort by tag first then frequence.
    tag_counts: list of tuples. example:[('python', 2), ('abc', 1)]
    return: sorted tag_counts.
    """
    tag_counts.sort(key=lambda x: x[0])
    tag_counts.sort(key=lambda x: x[1], reverse=True)
    return tag_counts