def show_most_common_entities(entity_dict, n=5):
    """Format information on entity count in a string

    Args:
        entity_dict (dictionary): entities and their attributes
        n (int, optional): only the n most common occurrences are used. Defaults to 5.

    Return:
        string: formatted output string
    """
    out_s = ''
    for ent_type, ents in entity_dict.items():
        out_s += '\t{}:\n'.format(ent_type)
        n_ents = {k: v for k, v in sorted(ents.items(), key=lambda item: item[1], reverse=True)}
        for idx, (ent, count) in enumerate(n_ents.items()):
            out_s += '\t\t{}:\t{} ({})\n'.format(idx+1, ent, count)
            if idx >= n:
                break
        out_s += '\n'
    return out_s