kernel.py: begin implementation of write()