Added a python implementation

Please merge
I think here need to add some header like

    # -*- coding: utf-8 -*-

But the format of the header for each file may need some discussion.