def has_remediation(rid, penalty):
    """ Test if a penalty contains a remediation with the given remediation ID"""

    remediations = penalty['remediation']
    if isinstance(remediations, list):
        for rem in remediations:
            if rem['id'] == rid:
                return True
    else:
        if remediations['id'] == rid:
            return True
    return False