def_render_object(cls,object,*args,**kwargs):# The dict we will return to be rendered to JSON / output formatr_obj={}# Loop over all fields that are supposed to be outputforkey,valueincls.MODIFICATIONS['fields'].items():# Get properties for this fieldfield_props=cls.MODIFICATIONS['fields'][key]# Check if it has to be renamediffield_props.get('rename',False):obj=getattr(object,field_props.get('rename'))# if rename is specified we need to change the keyobj_key=field_props.get('rename')else:# if not, move onobj=getattr(object,key,None)obj_key=key