Python implementation
Simple python implementation.