Python implementation: Takes turns into account.