<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stream(self, func, *args, **kwargs):
 """Watch an API resource and stream the result back via a generator. :param func: The API function pointer. Any parameter to the function can be passed after this parameter. :return: Event object with these keys: 'type': The type of event such as "ADDED", "DELETED", etc. 'raw_object': a dict representing the watched object. 'object': A model representation of raw_object. The name of model will be determined based on the func's doc string. If it cannot be determined, 'object' value will be the same as 'raw_object'. Example: v1 = kubernetes_asyncio.client.CoreV1Api() watch = kubernetes_asyncio.watch.Watch() async for e in watch.stream(v1.list_namespace, timeout_seconds=10):
 type = e['type'] object = e['object'] # object is one of type return_type raw_object = e['raw_object'] # raw_object is a dict if should_stop: watch.stop() """

        self.close()
        self._stop = False
        self.return_type = self.get_return_type(func)
        kwargs['watch'] = True
        kwargs['_preload_content'] = False

        self.func = partial(func, *args, **kwargs)

        return self