              [self.save_object(item, **kwargs) for item in self.object]
          else:
              self.save_object(self.object, **kwargs)
  
          if self._deleted:
              [self.delete_object(item) for item in self._deleted]
  
          return self.object
  
  
 
</s> remove                             try:
                                identity = self.get_identity(item)
                            except:
                                self.object = None
                            else:
                                self.object = identity_to_objects.pop(identity, None)
 </s> add                             identity = self.get_identity(item)
                            self.object = identity_to_objects.pop(identity, None) </s> remove                 try:
                    iter(data)
                    if isinstance(data, dict):
                        raise TypeError
                except TypeError:
                    self._errors = {'non_field_errors': ['Expected a list of items']}
                else:
 </s> add                 if hasattr(data, '__iter__') and not isinstance(data, (dict, six.text_type)): </s> remove         return data.get('id')
 </s> add         try:
            return data.get('id', None)
        except AttributeError:
            return None
        if self.allow_delete and self._deleted:
              [self.save_object(item, **kwargs) for item in self.object]
          else:
              self.save_object(self.object, **kwargs)
  
        if self.allow_delete and self._deleted:
              [self.delete_object(item) for item in self._deleted]
  
          return self.object
  
  
keep keep keep keep replace keep keep keep keep keep
 Bit of extra tidying and plenty of docs 
rest_framework/serializers.py