The last security lesson is about things that arrive from outside and are not just a string: archives that contain many files, libraries that you install, secrets that your program must hold. The same principle holds for all of them. Treat what arrives as untrusted until you have checked it, limit what it can do, and assume that some single defence will fail, so that you have more than one.
More lessons in Complete Python Programming