def check_all_constraints(csp) :
    """Return False if the problem's assigned values violate some constraint,
    otherwise True"""
    assignments = csp.assignments
    constraints = csp.constraints
    for constraint in constraints:
        if constraint.var1 in assignments and constraint.var2 in assignments:
           if not constraint.check(assignments[constraint.var1], assignments[constraint.var2]):
               return False
    return True