'Set the cover for this book.  data can be either a QImage,
QPixmap, file object or bytestring. It can also be None, in which
case any existing cover is removed.'

@write_api
def set_cover(self, book_id_data_map):

    for (book_id, data) in book_id_data_map.iteritems():
        try:
            path = self._field_for(u'path', book_id).replace(u'/', os.sep)
        except AttributeError:
            self._update_path((book_id,))
            path = self._field_for(u'path', book_id).replace(u'/', os.sep)
        self.backend.set_cover(book_id, path, data)
    for cc in self.cover_caches:
        cc.invalidate(book_id_data_map)
    return self._set_field(u'cover', {book_id: (0 if (data is None) else 1) for (book_id, data) in book_id_data_map.iteritems()})
