code clean-up in stream.py module [ci skip]