Python implementation added.