Update the

if field_name in self.validated_fields.keys():

to

if field_name in self.validated_fields: