def get_max_subset(submod, S, big_set, k):
    """
    Gets subset of size k that maximizes sum_{u in S}f_u(v) for v in N

    :param submod:
    :param S:
    :param big_set:
    :param k:
    :return: subset
    """

    marginals = []
    for u in big_set:
        marginals.append((u, submod.marginal(S, u)))
    sorted_marginals = sorted(marginals, key=lambda elem: elem[1], reverse=True)
    return set([elem[0] for elem in sorted_marginals[:k]])