<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 modify(self, **kwargs):
        '''
        Corresponds to PATCH request with a resource identifier, modifying a single document in the database
        '''
        try:
            pk = self.pk_type(kwargs['pk'])
            # modify is a class method on MongoCollectionMixin
            result = await self._meta.object_class.modify(self.db, key=pk, data=self.data)
            if result is None:
                raise NotFound('Object matching the given {} was not found'.format(self.pk))
            return await result.serialize()
        except Exception as ex:
            logger.exception(ex)
            raise BadRequest(ex)