pop the value under the 'stream' key of the kwargs dictionary, if it exists replace it for self.stream, if not replace sys.stdout for self.stream.
self . stream = kwargs . pop ( 'stream' , sys . stdout )