stmhal: Reimplement file support using stream protocol API.

This adds readline(), readall(), etc. methods. Also other fixes to make
Python API compliant and "with" support.