<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_keys(self, bucket, timeout=None):
 """ Lists all keys in a bucket via a stream. This is a generator method which should be iterated over. .. warning:: Do not use this in production, as it requires traversing through all keys stored in a cluster. The caller should explicitly close the returned iterator, either using :func:`contextlib.closing` or calling ``close()`` explicitly. Consuming the entire iterator will also close the stream. If it does not, the associated connection might not be returned to the pool. Example:: from contextlib import closing # Using contextlib.closing with closing(client.stream_keys(mybucket)) as keys: for key_list in keys: do_something(key_list) # Explicit close() stream = client.stream_keys(mybucket) for key_list in stream: do_something(key_list) stream.close() :param bucket: the bucket whose properties will be set :type bucket: RiakBucket :param timeout: a timeout value in milliseconds :type timeout: int :rtype: iterator """

        if not riak.disable_list_exceptions:
            raise ListError()

        _validate_timeout(timeout)

        def make_op(transport):
            return transport.stream_keys(bucket, timeout=timeout)

        for keylist in self._stream_with_retry(make_op):
            if len(keylist) > 0:
                if six.PY2:
                    yield keylist
                else:
                    yield [bytes_to_str(item) for item in keylist]