def convert(self, raw_data, **kw): """ Converts the raw data into richer Python constructs according to the fields on the model """ value = convert(self.__class__, raw_data, **kw) for i, j in value.items(): if isinstance(j, list): for x in j: set_parent(x, self) else: set_parent(j, self) return value