'Return a dictionary with instance diagnostics.'

def instance_diagnostics(self, diagnostics):

    diagnostics_dict = {}
    for field in INSTANCE_DIAGNOSTICS_PRIMITIVE_FIELDS:
        diagnostics_dict[field] = self._get_obj_field(diagnostics, field)
    for list_field in INSTANCE_DIAGNOSTICS_LIST_FIELDS:
        diagnostics_dict[list_field] = []
        list_obj = getattr(diagnostics, list_field)
        for obj in list_obj:
            obj_dict = {}
            for field in INSTANCE_DIAGNOSTICS_LIST_FIELDS[list_field]:
                obj_dict[field] = self._get_obj_field(obj, field)
            diagnostics_dict[list_field].append(obj_dict)
    for obj_field in INSTANCE_DIAGNOSTICS_OBJECT_FIELDS:
        diagnostics_dict[obj_field] = {}
        obj = self._get_obj_field(diagnostics, obj_field)
        for field in INSTANCE_DIAGNOSTICS_OBJECT_FIELDS[obj_field]:
            diagnostics_dict[obj_field][field] = self._get_obj_field(obj, field)
    return diagnostics_dict
