import operator


def maxN(arr, n):
    """
        Return the top-n element in a list/dict
    """
    if type(arr) == list:
        return sorted(arr, reverse=True)[:n]
    else:
        return dict(sorted(arr.items(), key=operator.itemgetter(1), reverse=True)[:n])