def to_dict(self):
patterns = None
if self.regexes_per_intent is not None:
patterns = {i: [r.pattern for r in regex_list] for i, regex_list in
self.regexes_per_intent.iteritems()}
return {
"language_code": self.language.iso_code,
After Change
if self.language is not None:
language_code = self.language.iso_code
return {
"config": self.config.to_dict(),
"language_code": language_code,
"patterns": self.patterns,
"group_names_to_slot_names": self.group_names_to_slot_names,