'Remove campaigns.
Find campaigns with only a single target and subtract their required
impressions from the target and remove the campaign.'

def reduce_campaigns(self, campaigns, targets):

    targets_by_name = {target.name: target for target in targets}
    changed = False
    reduced_campaigns = []
    for campaign in campaigns:
        if (len(campaign.target_names) == 1):
            changed = True
            target_name = campaign.target_names[0]
            target_impressions = targets_by_name[target_name].impressions
            target_impressions -= campaign.impressions
            new_target = SimpleTarget(target_name, target_impressions)
            targets_by_name[target_name] = new_target
        else:
            reduced_campaigns.append(campaign)
    reduced_targets = targets_by_name.values()
    return (changed, reduced_campaigns, reduced_targets)
