def marginal_contribution_set(game, player, lower_set):
    """
    Takes a subset of players and a player, transforms them into a higher set c2 and lower set c1 and calculates
     their marginal contribution based on the implemented payoff function.

    :param player: An element of self.players
    :type player: str
    :param lower_set: A subset of self.players of which player should be no part.
    :type lower_set: set
    :return:
    """
    lower_set = set(lower_set)
    try:
        higher_set = lower_set | {player}
    except TypeError:
        raise ValueError('Given set could not be joined with player %s' % player)
    marginal_contribution = max(0, game.payoff(higher_set)) - max(0, game.payoff(lower_set))
    return marginal_contribution