Python implementation.
Python implementation.