format code, and support python 3.x.
change StringIO to BytesIO, add function draw_grid_and_fork, optimization code.
change style, add tool modify code,add comment.