Python implementation updated

Explanation updated as well.