def richest_ids(ids: dict, top=100) ->dict:
    """
    Given a dictionary with IDs and number of entries,
    return top X IDs with largest numbers.

    :param ids: dictionary with IDs and entry counts
    :param top: how many do you want (descending order)? Enter 0 for full sorted list
    :return: ordered subset of IDs
    """
    if top == 0:
        top = len(ids)
    rich_selection = dict(sorted(ids.items(), key=lambda t: t[1], reverse=
        True)[:top])
    return rich_selection
