defas_dict(self)->Dict[str,object]:"""Return the object converted into an API-friendly dict. """result={}forfieldinfields(self):val=getattr(self,field.name)ifvalisNone:continueifisinstance(val,Base):val=val.as_dict()result[field.name]=valreturnresult