def string_stream(s, separators='\n'):
    start = 0
for end in range(len(s)):
    if s[end] in separators:
        yield s[start:end]
start = end + 1
if start < end:
    yield s[start:end + 1]
creating stream to iterate over from string in Python