docs: Fix typos and obvious errors (GH-161386)
* docs: Fix typos in API references and examples
* docs: Revert turtle example change
* docs: Fix unresolved ensure_value references in optparse
* docs: Match tracemalloc example traceback order to its output
* Apply batched suggestions from code review
---------
(cherry picked from commit cbaba022cf)
Co-authored-by: Inada Naoki <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>