A practical guide to structured logging and error handling in Python