Please read the following Python notebooks. You can make a copy (File > Make a copy) and run them in your Google Drive, using Colab; you can modify your copy and play with it. You may need to be logged in via @ucsc.edu to access the material.
also a good reading is this introduction to decorators.
Other resources on Python: