py: Change stream protocol API: fns return uint; is_text for text.