import copy


def removeDebuff(state, remDebuff) :
    """Removes a debuff from a state
    """
    newState = copy.deepcopy(state)
    # Removes the debuff from the list of debuffs
    newState['enemy']['debuff'] = [ d for d in newState['enemy']['debuff'] if d['name'] not in remDebuff ]
    # Removes the potential remaining actions to make the debuff fall down
    newState['timeline']['nextActions'] = [ na for na in newState['timeline']['nextActions'] if na[1] not in [ { 'type': 'removeDebuff', 'name': dn } for dn in remDebuff ] ]
    return newState