class softconstraint(constraint)""" constraint consists of scopea tuple of variables functiona real-valued function that can applied to tuple of values stringa string for printing the constraints all of the strings must be unique for the variables ""def __init__(selfscopefunctionstring=noneposition=none)constraint __init__(selfscopefunctionstringposition def value(self,assignment)return self holds(assignmentcspsoft py -(continued variable(' '{ , }position=( , ) variable(' '{ , , }position=( , ) variable(' '{ , }position=( , ) variable(' '{ , }position=( , ) def fun( , )if == return ( if == else elsereturn ( if == else if == else softconstraint([ , ], fun," "def fun( , )if == return ( if == else elif == return ( if == else elsereturn ( if == else softconstraint([ , ], fun," "def fun( , )if == return ( if == else elif == return elsereturn ( if == else softconstraint([ , ], fun," " def penalty_if_same(pen)"returns function that gives penalty of pen if the arguments are the samereturn lambda , (pen if ( ==yelse softconstraint([ , ],penalty_if_same( )," " scsp csp("scsp "{ , , , }[ , , , ] ##the second soft csp has an extra variableand constraints variable(' '{ , }position=( , ) softconstraint([ , ],penalty_if_same( )," " softconstraint([ , ],penalty_if_same( )," "scsp csp("scsp "{ , , , , }[ , , , , , ]version june