Outline:
Writing a function that the compiler will accept is much easier than writing a function that will get through code review on the first pass. I've written and reviewed lots of functions and the same advice comes up again and again.
Jack has been using Python for over 15 years and is a Python core committer for 10 of those years. His PyCon talks (Stop Writing Classes, Name Things Once) are popular on the YouTubes.