[python] add Socket.read and Socket.write (closes #3325)