def checkanswer(self, user_answer):
     user_answer = user_answer.lower()
     user_answer = user_answer.replace('^', '**')
     user_answer = parse_expr(user_answer, transformations=transformations)
     # if not (isinstance(user_answer, sy.core.power.Pow) or isinstance(user_answer, sy.core.mul.Mul)):
     #     return False
     # if isinstance(user_answer, sy.core.mul.Mul):
     #     user_factors = user_answer.args
     #     user_factors = [sy.factor(factor) for factor in user_factors]
     #     check_factors = sets_evaluate_equal(set(self.answer.args), set(user_factors))
     # constraints = [check_factors,
     #                 type(self.answer) == type(user_answer)]
     # print([type(elem) for elem in self.answer.args], [type(elem) for elem in user_answer.args])
     # print(type(self.answer), type(user_answer))
     # print(constraints)
     # print([answer for answer in self.answers])
     # return any([sets_evaluate_equal(set(answer.args), set(user_answer.args)) for answer in self.answers])
     # print(type(user_answer), type(self.answer))
     # return (isinstance(user_answer, sy.core.power.Pow) or isinstance(user_answer, sy.core.mul.Mul)) and sy.expand(user_answer) == sy.expand(self.answer)
     # return user_answer == self.answer
     answer = parse_expr(str(self.answer), transformations=transformations)
     # ans_numer, ans_denom = get_numer_denom(answer)
     # user_numer, user_denom = get_numer_denom(user_answer)
     # sufficient_conditions = [check_congruence_after_factoring_out_gcf(ans_numer, user_numer) and check_congruence_after_factoring_out_gcf(ans_denom, user_denom)]
     # sufficient_conditions += [check_congruence_after_factoring_out_gcf(-ans_numer, user_numer) and check_congruence_after_factoring_out_gcf(-ans_denom, user_denom)]
     # check_congruence_after_factoring_out_gcf(sy.Symbol('x'), user_answer)
     # return answer ==  user_answer or answer == factor_negative_out_from_denominator(user_answer)
     # return any(sufficient_conditions)
     return congruence_of_quotient(answer, user_answer)
 def validator(user_answer):
     try:
         user_answer = user_answer.lower()
         user_answer = user_answer.replace('^', '**')
         user_answer = parse_expr(user_answer, transformations=transformations)
         answer = parse_expr('x', transformations=transformations)
         congruence_of_quotient(answer, user_answer)
         # ans_numer, ans_denom = get_numer_denom(answer)
         # user_numer, user_denom = get_numer_denom(user_answer)
         # sufficient_conditions = [check_congruence_after_factoring_out_gcf(ans_numer, user_numer) and check_congruence_after_factoring_out_gcf(ans_denom, user_denom)]
         # sufficient_conditions += [check_congruence_after_factoring_out_gcf(-ans_numer, user_numer) and check_congruence_after_factoring_out_gcf(-ans_denom, user_denom)]
         # factor_negative_out_from_denominator(user_answer)
         # type(user_answer) == type(parse_expr('5', transformations=transformations))
         # if 'x' in str(user_answer):
         #     check_congruence_after_factoring_out_gcf(sy.Symbol('x'), user_answer)
     except:
         raise SyntaxError