[python] finalized I/O interface with python