<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

async def update(self, **kwargs):
        '''
        Corresponds to PUT request with a resource identifier, updating a single document in the database
        '''
        try:
            self.data[self.pk] = self.pk_type(kwargs['pk'])
            updated_obj = await self._meta.object_class().update(self.db, data=self.data)
            if updated_obj is None:
                raise NotFound('Object matching the given {} was not found'.format(self.pk))
            return await updated_obj.serialize()
        except Exception as ex:
            logger.exception(ex)
            raise BadRequest(ex)